Jackhammer ammo

Find any bugs in Vega Strike? See if someone has already found it, or report them here!
Post Reply
TBeholder
Elite Venturer
Elite Venturer
Posts: 753
Joined: Sat Apr 15, 2006 2:40 am
Location: chthonic safety

Jackhammer ammo

Post by TBeholder »

...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.
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Jackhammer ammo

Post by klauss »

Chemical lasers get expended over time (in reality), so over time makes more sense to me.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
TBeholder
Elite Venturer
Elite Venturer
Posts: 753
Joined: Sat Apr 15, 2006 2:40 am
Location: chthonic safety

Re: Jackhammer ammo

Post by TBeholder »

klauss wrote:Chemical lasers get expended over time (in reality), so over time makes more sense to me.
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...

Oops... :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--;
So i guess we only have to add in physics section

Code: Select all

			<var name="reduce_beam_ammo" value="1"/>
But if you want to change it to continuously expended, i.e. mostly do with ammo whatever happens to the energy, i dug it out for you: the energy is calculated in vegastrike/src/cmd/unit_generic.cpp, lines 1568 etc:

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;
                    }
However, it looks like there's also needed a check added to the energy check in vegastrike/src/cmd/unit_generic.cpp, lines 1508 for net games and 1520 for local, so that they would stop firing when out of ammo.

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
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Jackhammer ammo

Post by klauss »

If you look carefully, those are:

Code: Select all

static float whatever = XMLSupport::parse_whatever( get whatever );
Which means, since it's static, that it's called only the first time the statement is executed.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
TBeholder
Elite Venturer
Elite Venturer
Posts: 753
Joined: Sat Apr 15, 2006 2:40 am
Location: chthonic safety

Re: Jackhammer ammo

Post by TBeholder »

klauss wrote:Which means, since it's static, that it's called only the first time the statement is executed.
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. :oops:
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
Post Reply