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..bf7317c0 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf @@ -206,9 +206,24 @@ 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); + + // remove and add back magazines + 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; diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles_old.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles_old.sqf index 04f0f00b..98eb3655 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles_old.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles_old.sqf @@ -225,22 +225,23 @@ 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); - - // turrets - /* - _mags = _vehicle magazinesTurret [0]; - { - _object removeMagazinesTurret [_x, [0]]; - } forEach _mags; - - _mags = _vehicle magazinesTurret [-1]; - { - _object removeMagazinesTurret [_x, [-1]]; - } forEach _mags; - */ + // remove and add back magazines + 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); + }; + }; if (EPOCH_DEBUG_VEH) then { _marker = createMarker [str(_location) , _location]; @@ -253,9 +254,6 @@ for "_i" from 1 to _maxVehicleLimit do { if (_simulationHandler) then{ _vehicle enableSimulationGlobal false; }; - - - }; }; }; diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_save_vehicle.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_save_vehicle.sqf index 8b286c16..17bdea1e 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_save_vehicle.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_save_vehicle.sqf @@ -95,7 +95,7 @@ if (!isNull _vehicle) then { ]; _colorSlot = _vehicle getVariable ["VEHICLE_TEXTURE",0]; - _VAL = [typeOf _vehicle,[(getposATL _vehicle call EPOCH_precisionPos),vectordir _vehicle,vectorup _vehicle],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,magazinesAmmo _vehicle,_colorSlot]; + _VAL = [typeOf _vehicle,[(getposATL _vehicle call EPOCH_precisionPos),vectordir _vehicle,vectorup _vehicle],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,[true,magazinesAllTurrets _vehicle],_colorSlot]; ["Vehicle", _vehHiveKey, EPOCH_expiresVehicle, _VAL] call EPOCH_fnc_server_hiveSETEX; }; };