How to make a weapon which uses energy and not ammunition. To keep things simple we will inherit a lot things from Lurker weapon like shapes, animations and audio.

Step 1:
Create a new energyRifle.cs file in art/datablocks/weapons.
The important bits are that the ImageDatablock does NOT have "ammo" listed, or there will be a conflict with "usesEnergy".
"minEnergy" is the minimum amount of energy the player must have for it to fire.
"infiniteAmmo" should be set to "true" to prevent console spam from weaponImage::onFire attempting to decrease ammo which does not exist. Alternatively the onFIre script could be changed to "if ( !%this.infiniteAmmo || %this.usesEnergy )" but we will stick to using "infiniteAmmo" in the imageDatablock for this resource.
"stateEnergyDrain" in the onFire state drains %n energy per full second so divide by the timeOut state if you want exact amounts.

Step 3
Stock Torque3D is set not to show the weapon icon on the player's HUD if there is no ammo, so we need to change that.
In scripts/server/weapon.cs edit the "WeaponImage::onMount" function, go right to the bottom and set a new condition if there is no ammo.

Part 6
Finally we need to set the player's energy to the HUD so they can see what is going on. Open the GUI Editor and add a "GuiHealthBarHud" and a "GuiHealthTextHud". Remember to set both of these to display Energy or else they will show health. As the "minEnergy" for shooting is 10 in the imageDatablock, set the bar's "pulseThreshold" to 0.1 (10%) and the text's "warnThreshold" to 10.
Here is what my art/gui/playGui.gui looks like:

EDIT
Turns out there is a crash if a non-ammo using weapon is the default weapon loaded at runtime and then changes to another weapon. Crash does not occur if the starting weapon uses ammo ... FFS Torque ...

Found a crash caused by RefreshWeaponHUD not displaying the ammoAmount if a non-ammo weapon is the first one loaded at startup and then the player switches to an ammo-using weapon. No crash if first weapon loaded is an ammo-user. Makes no sense but hey, we're all used to that.
Fix posted in resource, also suggest fix goes into main repo.

A crash? I think we should try to make the script API as crash-resistant as possible. Any chance you could see what's happening in the engine to allow it to crash? A minimal example script would also be appreciated .

@ buckmaster
Seems to crash looking for a valid character in gfx/gFont.h. Only happens if there is no ammoAmount to show and thus ammoAmount in scripts/client/client.cs is hidden. And it only crashes if the first weapon on startup is non-ammo. Loading an ammo-wpn first and then switching back and forth between ammo and non-ammo weapons is fine.