diff --git a/addons/repair/XEH_postInit.sqf b/addons/repair/XEH_postInit.sqf index d61f20a31e..7095b0bfd0 100644 --- a/addons/repair/XEH_postInit.sqf +++ b/addons/repair/XEH_postInit.sqf @@ -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); }; diff --git a/addons/repair/functions/fnc_addSpareParts.sqf b/addons/repair/functions/fnc_addSpareParts.sqf index c7366b27ba..6dfbb49bc0 100644 --- a/addons/repair/functions/fnc_addSpareParts.sqf +++ b/addons/repair/functions/fnc_addSpareParts.sqf @@ -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)