From 532df074f20d1fb4925cc5a1b806643faecbcb1b Mon Sep 17 00:00:00 2001 From: He-Man Date: Wed, 14 Dec 2016 21:49:55 +0100 Subject: [PATCH] Safe/Load all Vehicle Magazines correctly --- .../epoch_vehicle/EPOCH_load_vehicles.sqf | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf index a9b3d94a..4d3b8cb5 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf @@ -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;