From 532df074f20d1fb4925cc5a1b806643faecbcb1b Mon Sep 17 00:00:00 2001 From: He-Man Date: Wed, 14 Dec 2016 21:49:55 +0100 Subject: [PATCH 1/5] 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; From 4b88db027999a0ec459c017af3eb4a01b767eece Mon Sep 17 00:00:00 2001 From: He-Man Date: Wed, 14 Dec 2016 21:51:35 +0100 Subject: [PATCH 2/5] Safe/Load all Vehicle Magazines correctly --- .../epoch_vehicle/EPOCH_load_vehicles_old.sqf | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) 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..ad3afd50 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,9 +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); + // 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); + }; + }; // turrets /* From 113efd874b00eb947297ee32a3c0ea290d207cb2 Mon Sep 17 00:00:00 2001 From: He-Man Date: Wed, 14 Dec 2016 21:52:48 +0100 Subject: [PATCH 3/5] Safe/Load all Vehicle Magazines correctly --- .../compile/epoch_vehicle/EPOCH_load_vehicles.sqf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 4d3b8cb5..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,7 +206,8 @@ 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 + + // remove and add back magazines if !((_arr select 6) isequalto []) then { if ((_arr select 6 select 0) isequaltype true) then { { @@ -223,6 +224,7 @@ for "_i" from 1 to _maxVehicleLimit do { {_vehicle addMagazine _x}count (_arr select 6); }; }; + // set damage and hitpoints _vehicle setDamage _damage; _allHitpoints = getAllHitPointsDamage _vehicle; From 3f4517f1092764136655d1636935f4f2c51780d4 Mon Sep 17 00:00:00 2001 From: He-Man Date: Wed, 14 Dec 2016 21:53:24 +0100 Subject: [PATCH 4/5] Safe/Load all Vehicle Magazines correctly --- .../compile/epoch_vehicle/EPOCH_server_save_vehicle.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }; }; From 5859bf2356415804b38a55d412a1753cf5278958 Mon Sep 17 00:00:00 2001 From: He-Man Date: Wed, 14 Dec 2016 21:58:08 +0100 Subject: [PATCH 5/5] Safe/Load all Vehicle Magazines correctly --- .../epoch_vehicle/EPOCH_load_vehicles_old.sqf | 16 ---------------- 1 file changed, 16 deletions(-) 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 ad3afd50..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 @@ -243,19 +243,6 @@ for "_i" from 1 to _maxVehicleLimit do { }; }; - // turrets - /* - _mags = _vehicle magazinesTurret [0]; - { - _object removeMagazinesTurret [_x, [0]]; - } forEach _mags; - - _mags = _vehicle magazinesTurret [-1]; - { - _object removeMagazinesTurret [_x, [-1]]; - } forEach _mags; - */ - if (EPOCH_DEBUG_VEH) then { _marker = createMarker [str(_location) , _location]; _marker setMarkerShape "ICON"; @@ -267,9 +254,6 @@ for "_i" from 1 to _maxVehicleLimit do { if (_simulationHandler) then{ _vehicle enableSimulationGlobal false; }; - - - }; }; };