diff --git a/components/gearScript/fn_createLoadoutLocker.sqf b/components/gearScript/fn_createLoadoutLocker.sqf index d70caf1..7647c88 100644 --- a/components/gearScript/fn_createLoadoutLocker.sqf +++ b/components/gearScript/fn_createLoadoutLocker.sqf @@ -15,58 +15,92 @@ if (_gearVariant isEqualTo "") exitWith {}; if (IS_PLAYER) then { - _registry = LOADOUT_REGISTRY_DYNAMIC(_gearVariant); - - if (_registry isEqualTo []) exitWith {}; - - _codeTemplate = "['%1', (_this select 1), '%2'] call f_fnc_assignGear;"; - - { - _xCaps = toUpper _x; - - if !(_xCaps isEqualTo "DEFAULT") then - { - _condition = "!(_this getVariable ['f_var_assignGear_running', false])"; - - if (_xCaps isEqualTo "ZEUS") then - { - _condition = "!((_this getVariable ['f_var_assignGear_running', false]) or {!(_this getVariable ['f_var_isZeus', false])})"; - }; - - _locker addAction - [ - format ["Take loadout: %1", _xCaps], - format [_codeTemplate, _x, _faction], - nil, - 1.5, - false, - true, - "", - _condition, - 5 - ]; - }; - - } forEach _registry; + _registry = LOADOUT_REGISTRY_DYNAMIC(_gearVariant); + + if (_registry isEqualTo []) exitWith {}; + + _codeTemplate = "['%1', (_this select 1), '%2'] call f_fnc_assignGear;"; + + // Add the base ACE3 category + [ + _locker, + 0, + [], + [ + "cafe3_takeLoadout", + "Take Loadout", + "", + {}, + {true} + ] call ace_interact_menu_fnc_createAction + ] call ace_interact_menu_fnc_addActionToObject; + + { + _xCaps = toUpper _x; + + if !(_xCaps isEqualTo "DEFAULT") then + { + _condition = "!(_this getVariable ['f_var_assignGear_running', false])"; + + if (_xCaps isEqualTo "ZEUS") then + { + _condition = "!((_this getVariable ['f_var_assignGear_running', false]) or {!(_this getVariable ['f_var_isZeus', false])})"; + }; + + _locker addAction + [ + format ["Take loadout: %1", _xCaps], + format [_codeTemplate, _x, _faction], + nil, + 1.5, + false, + true, + "", + _condition, + 5 + ]; + + [ + _locker, + 0, + ["cafe3_takeLoadout"], + [ + format ["cafe3_takeLoadout_%1", _xCaps], + _xCaps, + "", + compile format ["_this = [_target, _player];" + _codeTemplate, _x, _faction], + compile ("_this = _player;" + _condition) + ] call ace_interact_menu_fnc_createAction + ] call ace_interact_menu_fnc_addActionToObject; + }; + + } forEach _registry; }; _locker setVariable ["f_var_isLoadoutLocker", true]; - _bagType = switch (_gearVariant) do { - case ("blufor"): {"Land_TentSolar_01_folded_bluewhite_F"}; - case ("opfor"): {"Land_TentSolar_01_folded_redwhite_F"}; - case ("indfor"): {"Land_TentSolar_01_folded_olive_F"}; - case ("guerrilla"): {"Land_TentSolar_01_folded_olive_F"}; - case ("civilian"): {"Land_TentSolar_01_folded_sand_F"}; - default {"RoadCone_L_F"}; + case "blufor": {"Land_TentSolar_01_folded_bluewhite_F"}; + case "opfor": {"Land_TentSolar_01_folded_redwhite_F"}; + case "indfor": {"Land_TentSolar_01_folded_olive_F"}; + case "guerrilla": {"Land_TentSolar_01_folded_olive_F"}; + case "civilian": {"Land_TentSolar_01_folded_sand_F"}; + default {"RoadCone_L_F"}; }; -_lockerBag = _bagType createVehicleLocal [0,0,0]; - +private _lockerBag = _bagType createVehicleLocal [0,0,0]; private _lockerHeightTop = (0 boundingBoxReal _locker) # 1 # 2; private _bagHeightBottom = (0 boundingBoxReal _lockerBag) # 0 # 2; _lockerBag attachTo [_locker, [0,0,_lockerHeightTop - _bagHeightBottom]]; +_locker setVariable ["f_var_lockerBag", _lockerBag, false]; + +_locker addEventHandler ["Deleted", + { + params ["_locker"]; + + deleteVehicle (_locker getVariable ["f_var_lockerBag", objNull]); + } +]; diff --git a/components/gearScript/zen/fn_zen_createLoadoutLocker.sqf b/components/gearScript/zen/fn_zen_createLoadoutLocker.sqf index 08a89da..7bcf535 100644 --- a/components/gearScript/zen/fn_zen_createLoadoutLocker.sqf +++ b/components/gearScript/zen/fn_zen_createLoadoutLocker.sqf @@ -21,6 +21,12 @@ private _createLocker = private _lockerModel = ["Metal_Locker_F", "Land_OfficeCabinet_02_F"] select (isNull (configFile >> "CfgVehicles" >> "Metal_Locker_F")); _locker = _lockerModel createVehicle [0,0,0]; _locker setPosASL _position; + + { + if (!isNull getAssignedCuratorUnit _x) then { + [_x, [[_locker], false]] remoteExecCall ["addCuratorEditableObjects", 2, false]; + }; + } forEach allCurators; }; // In case picked object becomes a locker while zeus is in the side selection menu. diff --git a/description.ext b/description.ext index 0bdbfc9..d55ed2d 100644 --- a/description.ext +++ b/description.ext @@ -38,6 +38,7 @@ loadScreen = "ca_logo_large.jpg"; enableDebugConsole = 1; +allowFunctionsRecompile = __EVAL(is3DENPreview); // Enables using BIS_fnc_recompile from 3DEN preview // CAFE - Debug variable, needs to exist pre-init. #include "startup\configuration\internals\debug.sqf"