mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cleaned up spare parts collection after SettingsInitialized, Check if vehicle already in collection
This commit is contained in:
parent
48e0f5757d
commit
6d27299883
@ -10,12 +10,15 @@ if (isServer) then {
|
||||
["SettingsInitialized", {
|
||||
GVAR(settingInitted) = true; // Stop collecting in FUNC(addSpareParts)
|
||||
|
||||
// Exit if adding spare parts disabled
|
||||
// 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);
|
||||
};
|
||||
|
@ -27,7 +27,9 @@ if !(["ace_cargo"] call EFUNC(common,isModLoaded)) exitWith {};
|
||||
|
||||
// Collect until SettingsInitialized
|
||||
if (isNil QGVAR(settingInitted)) exitWith {
|
||||
GVAR(addSparePartsCollection) pushBack _vehicle;
|
||||
if !(_vehicle in GVAR(addSparePartsCollection)) then {
|
||||
GVAR(addSparePartsCollection) pushBack _vehicle;
|
||||
};
|
||||
};
|
||||
|
||||
// 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