...doesn't really decrease. I'd post it into bugs (or write a fix myself), but here's a decision to make:
is beam weapons' ammo supposed to be expended per time (like energy) or per activation? Both variants make sense.
Jackhammer ammo
-
- Elite Venturer
- Posts: 753
- Joined: Sat Apr 15, 2006 2:40 am
- Location: chthonic safety
Jackhammer ammo
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
Re: Jackhammer ammo
Chemical lasers get expended over time (in reality), so over time makes more sense to me.
-
- Elite Venturer
- Posts: 753
- Joined: Sat Apr 15, 2006 2:40 am
- Location: chthonic safety
Re: Jackhammer ammo
Well, currently it says "coolant" (even better), but such things may be seen as continuously spent tubes, emitter wires and whatnot, or pre-packed "cartridges" that are wasted even if not fully used...klauss wrote:Chemical lasers get expended over time (in reality), so over time makes more sense to me.
Oops...
vegastrike/src/cmd/mount.cpp, lines 258-260:
Code: Select all
static bool reduce_beam_ammo = XMLSupport::parse_bool( vs_config->getVariable( "physics", "reduce_beam_ammo", "0" ) );
if (ammo > 0 && reduce_beam_ammo)
ammo--;
Code: Select all
<var name="reduce_beam_ammo" value="1"/>
Code: Select all
if (i->type->type == weapon_info::BEAM) {
if (i->ref.gun)
if ( ( !i->ref.gun->Dissolved() ) || i->ref.gun->Ready() )
energy -= i->type->EnergyRate*SIMULATION_ATOM;
} else if ( isMissile( i->type ) ) {
energy -= i->type->EnergyRate;
}
P.S.: i always wanted to ask: is it normal that functions like XMLSupport::parse_whatever called e.g. every time a weapon is fired? Could it just read once on init and use simple variables? Does it really parse xml in the main cycle and every other event, or does it actually reads once and it's just a scarily python-ized form of "get (field)"?
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
Re: Jackhammer ammo
If you look carefully, those are:
Which means, since it's static, that it's called only the first time the statement is executed.
Code: Select all
static float whatever = XMLSupport::parse_whatever( get whatever );
-
- Elite Venturer
- Posts: 753
- Joined: Sat Apr 15, 2006 2:40 am
- Location: chthonic safety
Re: Jackhammer ammo
Ah, i see. Non statics only in inits and "slow" parts like load_mission and savegame. Just looks scary because there's a lot of these and most hangs on the next line.klauss wrote:Which means, since it's static, that it's called only the first time the statement is executed.
"Two Eyes Good, Eleven Eyes Better." -Michele Carter