Skip to content

IsRailgun

Punches a damaging line through the world from the muzzle to the target as the weapon fires.

Specification
Applies to
WeaponType
File
rules.ini
Section
[<ObjectType ID>]
Value
boolean
When omitted
no

The beam is worked out the instant the shot goes off, before the projectile has traveled anywhere. The line from the muzzle to the target’s center is walked in 50 steps, and every cell it passes into is examined: an object standing there is damaged when its center lies within [CombatDamage] RailgunDamageRadius of the line, and a structure in a crossed cell is never measured against that distance and always counts. The object aimed at is damaged whether or not the line actually crossed it. Each victim takes AmbientDamage through the weapon’s Warhead=, once, and the firing object is skipped.

rules.ini
[MyRailgun] ; example WeaponType
IsRailgun=yes
AmbientDamage=200 ; the beam's damage
Damage=0 ; the projectile carries none
AttachedParticleSystem=LargeRailgunSys ; a ParticleSystemType registered in [ParticleSystems]
ROF=60

The walk stops at the first point where the ground stands higher than the beam, so a hill between the two ends of the shot cuts it short there; a destroyable cliff at that point may be brought down, at the chance [CombatDamage] CollapseChance sets. The beam’s own settled point is where the particle system is drawn to.

Unlike a sonic weapon, a railgun does not give up its projectile’s damage — Damage= is still carried by the shot and still delivered on impact, so a weapon meant to do its work through the beam alone must set it to nothing.

The particle system named by AttachedParticleSystem= is spawned along the beam, and neither of the object’s weapons may fire again until it has burned out. While one is alive the reload delay is exactly ROF: the house’s rate of fire bias, the burst gaps and the random padding are all skipped, so the effect’s own lifetime and ROF together decide the firing rate. A structure with more than one round left waits a single frame instead, so only the effect’s own lifetime paces it.