From c08787c1e67d412b49b50426bf2f807e15528c89 Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Sat, 30 Oct 2021 00:16:21 +0200 Subject: [PATCH] Use the vanilla action instead of the ace interaction --- addons/cargo/XEH_postInit.sqf | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/addons/cargo/XEH_postInit.sqf b/addons/cargo/XEH_postInit.sqf index acd8ee9e15..0739b5ac09 100644 --- a/addons/cargo/XEH_postInit.sqf +++ b/addons/cargo/XEH_postInit.sqf @@ -127,20 +127,24 @@ GVAR(objectActions) = [ ] call EFUNC(interact_menu,createAction) ]; -GVAR(unloadAllVehiclesAction) = [ - QGVAR(unloadAllvehicles), localize "STR_A3_ACTION_UNLOAD_ALL_VEHICLES", "\A3\Ui_f\data\IGUI\Cfg\Actions\unloadAllVehicles_ca.paa", - { - params ["_target"]; - [_target] call FUNC(unloadAllVehicles); - }, - { - params ["_target", "_player"]; - [_target, _player] call FUNC(canShowUnloadAllVehicles); - } -] call EFUNC(interact_menu,createAction); - +private _unloadAllVehiclesAction = configFile >> "CfgActions" >> "UnloadAllVehicles"; { - [_x, 1, ["ACE_SelfActions"], GVAR(unloadAllVehiclesAction), true] call EFUNC(interact_menu,addActionToClass); + [_x, "InitPost", { + params ["_vehicle"]; + + private _actionID = _vehicle addAction [ + "", + FUNC(unloadAllVehicles), + nil, + getNumber (_unloadAllVehiclesAction >> "priority"), + false, + true, + getText (_unloadAllVehiclesAction >> "shortcut"), + '[_target, _this] call FUNC(canShowUnloadAllVehicles)' + ]; + _vehicle setUserActionText [_actionID, localize "STR_A3_ACTION_UNLOAD_ALL_VEHICLES", getText (_unloadAllVehiclesAction >> "textDefault")]; + _vehicle setVariable [QGVAR(unloadAllVehiclesAction), _actionID]; + }, nil, nil, true] call CBA_fnc_addClassEventHandler; } forEach ["LandVehicle", "Ship", "Air"]; // find all remaining configured classes and init them, see XEH_preStart.sqf