From 9fc10434812a61f8c85597f0b652137ad6983bce Mon Sep 17 00:00:00 2001 From: Bones50 Date: Fri, 11 May 2018 17:39:54 +1000 Subject: [PATCH] V2 Update Supports Exile 1.04 (inc VG) and Tank ammo saving (multi-magazine) --- ...ileServer_object_vehicle_database_load.sqf | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/Exile.Altis/Custom/ammoSave/ExileServer_object_vehicle_database_load.sqf b/Exile.Altis/Custom/ammoSave/ExileServer_object_vehicle_database_load.sqf index 1e5a470..4b9c28d 100644 --- a/Exile.Altis/Custom/ammoSave/ExileServer_object_vehicle_database_load.sqf +++ b/Exile.Altis/Custom/ammoSave/ExileServer_object_vehicle_database_load.sqf @@ -98,7 +98,14 @@ if !(_texture isEqualTo "") then forEach _texture; }; _vehicleObject enableSimulationGlobal false; -_vehicleObject call ExileServer_system_simulationMonitor_addVehicle; +if (getNumber(missionConfigFile >> "CfgSimulation" >> "enableDynamicSimulation") isEqualTo 1) then +{ + _vehicleObject enableDynamicSimulation true; +} +else +{ + _vehicleObject call ExileServer_system_simulationMonitor_addVehicle; +}; if (_vehicleObject call ExileClient_util_world_isInTraderZone) then { _vehicleObject allowDamage false; @@ -115,23 +122,28 @@ if (typeName _savedMagazines isEqualTo "ARRAY") then { { _turretPath = _x select 0; - for "_i" from (count _x - 1) to 1 step -1 do { _magData = _x select _i; _magClass = _magData select 0; _ammoCount = _magData select 1; - - _maxMagAmmo = (configFile >> "CfgMagazines" >> _magClass >> "count") call BIS_fnc_getCfgData; - _numMags = ceil (_ammoCount / _maxMagAmmo); - - while {_numMags > 1} do + if (["120mm",_magClass] call BIS_fnc_inString || ["125mm",_magClass] call BIS_fnc_inString) then { - _vehicleobject addMagazineTurret [_magClass, _turretPath]; - _numMags = _numMags - 1; - _ammoCount = _ammoCount - _maxMagAmmo; + _vehicleobject addMagazineTurret [_magClass,_turretPath,_ammoCount]; + } + else + { + _maxMagAmmo = (configFile >> "CfgMagazines" >> _magClass >> "count") call BIS_fnc_getCfgData; + _numMags = ceil (_ammoCount / _maxMagAmmo); + + while {_numMags > 1} do + { + _vehicleobject addMagazineTurret [_magClass, _turretPath]; + _numMags = _numMags - 1; + _ammoCount = _ammoCount - _maxMagAmmo; + }; + _vehicleobject setMagazineTurretAmmo [_magClass, _ammoCount, _turretPath]; }; - _vehicleobject setMagazineTurretAmmo [_magClass, _ammoCount, _turretPath]; }; } forEach _savedMagazines; };