mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use setting init delay function for addSpareParts
This commit is contained in:
parent
41db78b52b
commit
a8412361bd
@ -5,20 +5,3 @@
|
||||
|
||||
// wheels
|
||||
["setWheelHitPointDamage", {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call EFUNC(common,addEventHandler);
|
||||
|
||||
if (isServer) then {
|
||||
["SettingsInitialized", {
|
||||
GVAR(settingInitted) = true; // Stop collecting in FUNC(addSpareParts)
|
||||
|
||||
// Exit if adding spare parts disabled and clean collection
|
||||
if (!GVAR(addSpareParts)) exitWith {GVAR(addSparePartsCollection) = nil};
|
||||
|
||||
// Add spare parts to vehicles in collection
|
||||
{
|
||||
[_x] call FUNC(addSpareParts);
|
||||
} forEach GVAR(addSparePartsCollection);
|
||||
|
||||
// Clean collection
|
||||
GVAR(addSparePartsCollection) = nil;
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
};
|
||||
|
@ -40,6 +40,4 @@ PREP(spawnObject);
|
||||
PREP(useItem);
|
||||
PREP(useItems);
|
||||
|
||||
GVAR(addSparePartsCollection) = [];
|
||||
|
||||
ADDON = true;
|
||||
|
@ -26,10 +26,8 @@ TRACE_2("params",_vehicle,_amount);
|
||||
if !(["ace_cargo"] call EFUNC(common,isModLoaded)) exitWith {};
|
||||
|
||||
// Collect until SettingsInitialized
|
||||
if (isNil QGVAR(settingInitted)) exitWith {
|
||||
if !(_vehicle in GVAR(addSparePartsCollection)) then {
|
||||
GVAR(addSparePartsCollection) pushBack _vehicle;
|
||||
};
|
||||
if (!EGVAR(common,settingsInitFinished)) exitWith {
|
||||
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addSpareParts), _this];
|
||||
};
|
||||
|
||||
// Exit if not forced and add spare parts is disabled (after settings initted to make sure it really is)
|
||||
|
Loading…
Reference in New Issue
Block a user