WeaponTypes
Posted: 13 Sep 2007, 11:55
Since it seems this is not common knowledge here, I'll describe all the weapontypes in Spring, not in full detail.
These are the weapontypes Spring knows. There are no others, every weapon is one of these. I will use the names you can put into the WeaponType tag for easier access, I'll also list other tags that can create such a weapon. They are listed in the order they are decided by WeaponDefHandler so a weapon that fulfills the requirements for two uses the type that's listed earlier. WeaponType overrides the automatic detection completely and always takes precedence.
The weapon patch in rev 4264 changes some of the hardcoded behaviour to be mod-definable but this text assumes Spring 75b2. Please refer to the changelog for the list of changes.
AircraftBomb (dropped=1)
Drops a ballistic projectile (aka Plasma) at the same movement vector as the unit itself. It's only meant for planes. A plane that has a CBombDropper as its weapon1 is a bomber. The CBombDropper automatically calculates its burst and burstrate tags from its reload time and uses 5 as its reload time instead. It will fire if the first bomb would drop within a circle roughly unitspeed*burst*burstrate so the longer the burst and the faster the unit the larger the circle in which it will drop instead of not firing and hoping the next attack run will pass that circle.
StarburstLauncher(vlaunch=1)
Fires a projectile that rises vertically (starts with no velocity) for <weapontimer> seconds, then turns at a fixed rate towards its target. The projectile's lifetime depends on its range divided by its max speed (ignores acceleration) and the weapontimer somehow so the weapon can fall short depending on how these values are set. This is the only weapon that can properly perform intercepts and be interceptable. Emits a smoketrail.
BeamLaser (beamlaser=1)
Should be well known, this thing spawns a beam and does a portion of its total damage each frame. It can't have a burst or burstrate, it can't have collidefriendly=0, it can't be emit-sfxed if it has a beamtime longer than one frame and its damage decreases over range if the minIntensity=1 tag isn't used. The largebeamlaser tag allows changing the visual effect of the laser, doesn't affect the behaviour of the weapon itself in any way though. Beamlasers can be really annoying... BTW, their beam doesn't collide with water so if they're set to waterweapon=1 they can shoot normally even when underwater (won't shoot at underwater targets though).
Shield (isShield=1)
The shield. Really not much to say about this, the tags are all documented in the changelog.
TorpedoLauncher (waterweapon=1)
Fires a projectile that will behave ballistically out of water and like a missile in water. Since waterweapon=1 is usually set for them they can fire underwater and they will target underwater units. The torpedo is the only projectile that doesn't explode on the water surface. An aircraft carrying a TorpedoLauncher is a special case, the thing turns into a bomb dropepr that will spawn a torpedo projectile, probably to get the whole bomber flight behaviour. Note that the waterweapon tag is also used to make a weapon fire underwater, independent of its type.
DGun (weaponname contains the word "disintegrator")
This shoots a fireball that travels in a straight line. The fireball has no range limitation by itself so if it misses or is fired in FPS mode it will travel across the whole map and further. DGuns don't properly check their line of fire, if terrain is in the way they fire anyway. These things are meant to be used with noexplode=1 but of course you CAN use them without that, too. If ballistic=1 is set the fireball will be affected by gravity, the weapon won't compensate for it though so it will hit the ground before reaching the target. Might be useful for a Scorched Earth mod or something since you'd have to aim it manually to hit anything.
LightningCannon (sic) (lineofsight=1 and rendertype=7)
An instant hit weapon like the Beamlaser except with a lightning graphic and even more annoying. It won't damage shields and it has a hardcoded inaccuracy (comparable to targetMoveError, the code comment is "should make it weaker against air"...). Shares some of the weirdnesses with the beamlaser, e.g. being able to penetrate water.
LaserCannon (lineofsight=1 and either beamweapon=1 or weaponname contains "laser" (marked as "workaround for SWTA))
The OTA-style laser. Probably one of the least annoying weapons in the engine. Its length is defined by the duration tag (together with the speed), BTW.
MissileLauncher (lineofsight=1 and smoketrail=1)
Shoots a smoke-emitting projectile. It can use guidance, acceleration, etc. The projectile's lifetime depends on range/maxspeed so a slowly accelerating missile will fall short. It can also use trajectoryheight to have the shot arc but that has trouble with aiming at targets higher or lower than the shooter (see bug report, this REALLY could use some fixing). Pretty versatile weapon overall, if the laser rendering code was ported into this we could pretty much axe the LaserCannon completely.
EmgCannon (lineofsight=1 and rendertype=4 and color=2)
Few know about this, it's a line of sight (i.e. not ballistic) weapon that can use billboard rendering (looks like a sprite). No idea what drawbacks this has, noone ever uses it.
Flame (lineofsight=1 and rendertype=5)
The flamethrower. A really annoying weapon. AFAIK it won't even aim ahead of moving targets. Can't say much else about it since I haven't tried using it much but overall I'd avoid the weapontype and fake the effect somehow, it's not pretty when fast and won't hit jack when slow.
Cannon (anything that didn't trigger another weapon)
Aka plasma. Shoots a ballistic projectile. Unlike the DGun it aims properly. Can't be emit-sfxed properly, maybe a ballistic DGun can fill that role.
Melee (only reachable through WeaponType)
When it fires it simply damages the target, no ifs or buts. It doesn't use a projectile and doesn't care about the line of fire. It won't even report a proper heading and pitch to AimWeapon so if you plan on using it in 75b2 you have to slave it to another weapon to handle the aiming. May be useful to be the damage dealer for a cosmetic weapon, i.e. you slave the Melee to a weapon that does no damage but looks pretty and the Melee does the damage. Kinda like the weapons in Warcraft and so.
Rifle (only reachable through WeaponType)
An instant hit weapon but an apparently unmaintained one. It has a hardcoded firing and explosion effect. I wouldn't use it.
CNoWeapon (weaponname is NOWEAPON, not reachable by any tag)
Apparently a placeholder used when a weapon isn't present. It's not really a weapondef but generated when the unit demands a NOWEAPON.
These are the weapontypes Spring knows. There are no others, every weapon is one of these. I will use the names you can put into the WeaponType tag for easier access, I'll also list other tags that can create such a weapon. They are listed in the order they are decided by WeaponDefHandler so a weapon that fulfills the requirements for two uses the type that's listed earlier. WeaponType overrides the automatic detection completely and always takes precedence.
The weapon patch in rev 4264 changes some of the hardcoded behaviour to be mod-definable but this text assumes Spring 75b2. Please refer to the changelog for the list of changes.
AircraftBomb (dropped=1)
Drops a ballistic projectile (aka Plasma) at the same movement vector as the unit itself. It's only meant for planes. A plane that has a CBombDropper as its weapon1 is a bomber. The CBombDropper automatically calculates its burst and burstrate tags from its reload time and uses 5 as its reload time instead. It will fire if the first bomb would drop within a circle roughly unitspeed*burst*burstrate so the longer the burst and the faster the unit the larger the circle in which it will drop instead of not firing and hoping the next attack run will pass that circle.
StarburstLauncher(vlaunch=1)
Fires a projectile that rises vertically (starts with no velocity) for <weapontimer> seconds, then turns at a fixed rate towards its target. The projectile's lifetime depends on its range divided by its max speed (ignores acceleration) and the weapontimer somehow so the weapon can fall short depending on how these values are set. This is the only weapon that can properly perform intercepts and be interceptable. Emits a smoketrail.
BeamLaser (beamlaser=1)
Should be well known, this thing spawns a beam and does a portion of its total damage each frame. It can't have a burst or burstrate, it can't have collidefriendly=0, it can't be emit-sfxed if it has a beamtime longer than one frame and its damage decreases over range if the minIntensity=1 tag isn't used. The largebeamlaser tag allows changing the visual effect of the laser, doesn't affect the behaviour of the weapon itself in any way though. Beamlasers can be really annoying... BTW, their beam doesn't collide with water so if they're set to waterweapon=1 they can shoot normally even when underwater (won't shoot at underwater targets though).
Shield (isShield=1)
The shield. Really not much to say about this, the tags are all documented in the changelog.
TorpedoLauncher (waterweapon=1)
Fires a projectile that will behave ballistically out of water and like a missile in water. Since waterweapon=1 is usually set for them they can fire underwater and they will target underwater units. The torpedo is the only projectile that doesn't explode on the water surface. An aircraft carrying a TorpedoLauncher is a special case, the thing turns into a bomb dropepr that will spawn a torpedo projectile, probably to get the whole bomber flight behaviour. Note that the waterweapon tag is also used to make a weapon fire underwater, independent of its type.
DGun (weaponname contains the word "disintegrator")
This shoots a fireball that travels in a straight line. The fireball has no range limitation by itself so if it misses or is fired in FPS mode it will travel across the whole map and further. DGuns don't properly check their line of fire, if terrain is in the way they fire anyway. These things are meant to be used with noexplode=1 but of course you CAN use them without that, too. If ballistic=1 is set the fireball will be affected by gravity, the weapon won't compensate for it though so it will hit the ground before reaching the target. Might be useful for a Scorched Earth mod or something since you'd have to aim it manually to hit anything.
LightningCannon (sic) (lineofsight=1 and rendertype=7)
An instant hit weapon like the Beamlaser except with a lightning graphic and even more annoying. It won't damage shields and it has a hardcoded inaccuracy (comparable to targetMoveError, the code comment is "should make it weaker against air"...). Shares some of the weirdnesses with the beamlaser, e.g. being able to penetrate water.
LaserCannon (lineofsight=1 and either beamweapon=1 or weaponname contains "laser" (marked as "workaround for SWTA))
The OTA-style laser. Probably one of the least annoying weapons in the engine. Its length is defined by the duration tag (together with the speed), BTW.
MissileLauncher (lineofsight=1 and smoketrail=1)
Shoots a smoke-emitting projectile. It can use guidance, acceleration, etc. The projectile's lifetime depends on range/maxspeed so a slowly accelerating missile will fall short. It can also use trajectoryheight to have the shot arc but that has trouble with aiming at targets higher or lower than the shooter (see bug report, this REALLY could use some fixing). Pretty versatile weapon overall, if the laser rendering code was ported into this we could pretty much axe the LaserCannon completely.
EmgCannon (lineofsight=1 and rendertype=4 and color=2)
Few know about this, it's a line of sight (i.e. not ballistic) weapon that can use billboard rendering (looks like a sprite). No idea what drawbacks this has, noone ever uses it.
Flame (lineofsight=1 and rendertype=5)
The flamethrower. A really annoying weapon. AFAIK it won't even aim ahead of moving targets. Can't say much else about it since I haven't tried using it much but overall I'd avoid the weapontype and fake the effect somehow, it's not pretty when fast and won't hit jack when slow.
Cannon (anything that didn't trigger another weapon)
Aka plasma. Shoots a ballistic projectile. Unlike the DGun it aims properly. Can't be emit-sfxed properly, maybe a ballistic DGun can fill that role.
Melee (only reachable through WeaponType)
When it fires it simply damages the target, no ifs or buts. It doesn't use a projectile and doesn't care about the line of fire. It won't even report a proper heading and pitch to AimWeapon so if you plan on using it in 75b2 you have to slave it to another weapon to handle the aiming. May be useful to be the damage dealer for a cosmetic weapon, i.e. you slave the Melee to a weapon that does no damage but looks pretty and the Melee does the damage. Kinda like the weapons in Warcraft and so.
Rifle (only reachable through WeaponType)
An instant hit weapon but an apparently unmaintained one. It has a hardcoded firing and explosion effect. I wouldn't use it.
CNoWeapon (weaponname is NOWEAPON, not reachable by any tag)
Apparently a placeholder used when a weapon isn't present. It's not really a weapondef but generated when the unit demands a NOWEAPON.