diff options
author | Stijn Buys <ingar@osirion.org> | 2012-12-08 16:09:57 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-12-08 16:09:57 +0000 |
commit | 70237f8e16ed093104e6e42ba322902b8c5d1ddc (patch) | |
tree | 2889db84781ade499b1c51005a16a8413d8969d7 /src/game/base | |
parent | ee77bb0522d8ba8402e88806e10c3e534e6aba98 (diff) |
Added support for a projectile range key in weapons.ini.
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(); + } } } |