Safe/Load all Vehicle Magazines correctly

This commit is contained in:
He-Man 2016-12-14 21:49:55 +01:00 committed by GitHub
parent 81f3452bd9
commit 532df074f2

View File

@ -207,9 +207,22 @@ for "_i" from 1 to _maxVehicleLimit do {
} forEach _objTypes;
} forEach (_arr select 5);
// remove and add back magazines works for armed trucks but not helis ATM
{_vehicle removeMagazineGlobal _x}count (magazines _vehicle);
{_vehicle addMagazine _x}count (_arr select 6);
if !((_arr select 6) isequalto []) then {
if ((_arr select 6 select 0) isequaltype true) then {
{
_vehicle removeMagazinesTurret [_x select 0, _x select 1];
} foreach magazinesAllTurrets _vehicle;
{
if ((_x select 2) > 0) then {
_vehicle addMagazineTurret [_x select 0,_x select 1,_x select 2];
};
} foreach (_arr select 6 select 1);
}
else {
{_vehicle removeMagazineGlobal _x}count (magazines _vehicle);
{_vehicle addMagazine _x}count (_arr select 6);
};
};
// set damage and hitpoints
_vehicle setDamage _damage;
_allHitpoints = getAllHitPointsDamage _vehicle;