diff options
Diffstat (limited to 'src/game/base')
-rw-r--r-- | src/game/base/weapon.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/game/base/weapon.cc b/src/game/base/weapon.cc index b4d236d..ab1ae49 100644 --- a/src/game/base/weapon.cc +++ b/src/game/base/weapon.cc @@ -157,7 +157,7 @@ bool Weapon::init() if (weapon) { if (weaponsini.got_key_float("speed", f)) { - // speed is in meters / second, one gameunit is 100 meters + // speed is in meters / second, one game unit is 100 meters weapon->set_projectile_speed(f * 0.01f); continue; @@ -166,9 +166,19 @@ bool Weapon::init() continue; } else if (weaponsini.got_key_long("lifespan", l)) { + // lifespan in milliseconds weapon->set_projectile_lifespan((unsigned long) l); continue; + } else if (weaponsini.got_key_float("range", f)) { + // range in meters, one game unit is 100 meters + if (weapon->projectile_speed() == 0) { + weaponsini.unknown_error("cannot set range if projectile speed is 0!"); + } else { + weapon->set_projectile_lifespan((unsigned long) (10.0f * f / weapon->projectile_speed())); + } + continue; + } else if (weaponsini.got_key_float("damage", f)) { weapon->set_damage(f); continue; @@ -176,6 +186,10 @@ bool Weapon::init() } else if (weaponsini.got_key_string("model", str)) { weapon->set_projectile_modelname(str); continue; + + } else { + weaponsini.unknown_key(); + } } } |