ACE3/addons/repair/XEH_preInit.sqf
2021-11-11 12:41:25 +01:00

47 lines
1.4 KiB
Plaintext

#include "script_component.hpp"
ADDON = false;
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
#include "initSettings.sqf"
GVAR(allToolKits) = call (uiNamespace getVariable QGVAR(allToolKits));
["ACE_RepairItem_Base", "killed", {
params ["_object"];
[{deleteVehicle _this}, _object, 5] call CBA_fnc_waitAndExecute;
}] call CBA_fnc_addClassEventHandler;
// load tracks and wheels
if (isServer) then {
private _fnc_addSpareItems = {
if (!GVAR(addSpareParts)) exitWith {};
params ["_vehicle"];
private _spareTracks = _vehicle getVariable QGVAR(editorLoadedTracks);
if (isNil "_spareTracks") then {
_spareTracks = [0, 1] select (_vehicle isKindOf "Tank"); // must match eden attribute default
};
if (_spareTracks > 0) then {
[_vehicle, _spareTracks, "ACE_Track"] call FUNC(addSpareParts);
};
private _spareWheels = _vehicle getVariable QGVAR(editorLoadedWheels);
if (isNil "_spareWheels") then {
_spareWheels = [0, 1] select (_vehicle isKindOf "Car"); // must match eden attribute default
};
if (_spareWheels > 0) then {
[_vehicle, _spareWheels, "ACE_Wheel"] call FUNC(addSpareParts);
};
};
["Tank", "initPost", _fnc_addSpareItems] call CBA_fnc_addClassEventHandler;
["Car", "initPost", _fnc_addSpareItems] call CBA_fnc_addClassEventHandler;
};
ADDON = true;