From 95a5fb040ac7c09e4a371f60d24d0cb32daf9f44 Mon Sep 17 00:00:00 2001 From: TACHarsis <101965352+TACHarsis@users.noreply.github.com> Date: Sat, 22 Oct 2022 02:28:10 +0200 Subject: [PATCH] Arsenal - Add init/remove local events to Arsenal creation/destruction (#9064) * Added two local events to arsenal * onInitArsenal fired when Arsenal got initiated * onRemoveArsenal fired when Arsenal got removed * added them to the arsenal event listing in the docs * Update addons/arsenal/functions/fnc_removeBox.sqf Co-authored-by: BrettMayson * Update addons/arsenal/functions/fnc_removeBox.sqf Co-authored-by: BrettMayson * Renamed events in accordance with event naming patterns sans "on" * Apply suggestions from code review Co-authored-by: BrettMayson * Improved Docs Co-authored-by: BrettMayson --- addons/arsenal/functions/fnc_initBox.sqf | 2 ++ addons/arsenal/functions/fnc_removeBox.sqf | 3 ++- docs/wiki/framework/arsenal-framework.md | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/arsenal/functions/fnc_initBox.sqf b/addons/arsenal/functions/fnc_initBox.sqf index 1343a20f63..2bd4cb1854 100644 --- a/addons/arsenal/functions/fnc_initBox.sqf +++ b/addons/arsenal/functions/fnc_initBox.sqf @@ -57,5 +57,7 @@ if (_global && {isMultiplayer} && {{_object in _x} count GVAR(EHIDArray) == 0}) [_object, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToObject); [_object, _items, false] call FUNC(addVirtualItems); + + [QGVAR(boxInitialized), [_object, _items]] call CBA_fnc_localEvent; }; }; diff --git a/addons/arsenal/functions/fnc_removeBox.sqf b/addons/arsenal/functions/fnc_removeBox.sqf index 7620529ef3..8b24bf52e5 100644 --- a/addons/arsenal/functions/fnc_removeBox.sqf +++ b/addons/arsenal/functions/fnc_removeBox.sqf @@ -30,6 +30,7 @@ if (_global && {isMultiplayer}) then { [QGVAR(removeBox), [_object, false]] call CBA_fnc_globalEvent; }; } else { - _object setVariable [QGVAR(virtualItems), nil, false]; + _object setVariable [QGVAR(virtualItems), nil, false]; [_object, 0, ["ACE_MainActions", QGVAR(interaction)]] call EFUNC(interact_menu,removeActionFromObject); + [QGVAR(boxRemoved), _object] call CBA_fnc_localEvent; }; diff --git a/docs/wiki/framework/arsenal-framework.md b/docs/wiki/framework/arsenal-framework.md index 3d2134e057..ea089ed8a3 100644 --- a/docs/wiki/framework/arsenal-framework.md +++ b/docs/wiki/framework/arsenal-framework.md @@ -284,6 +284,8 @@ All are local. | Name | Arguments | Added in | | ------------- | ------------- | ------------- | +| ace_arsenal_boxInitialized | Arsenal box (OBJECT), items (BOOL or ARRAY) | +| ace_arsenal_boxRemoved | Arsenal box (OBJECT) | | ace_arsenal_displayOpened | Arsenal display (DISPLAY) | | ace_arsenal_displayClosed | None | | ace_arsenal_leftPanelFilled | Arsenal display (DISPLAY), current left panel IDC (SCALAR), current right panel IDC (SCALAR) |