From 153644b77a16e07e049a146782015aa428f8c75f Mon Sep 17 00:00:00 2001 From: Joko Date: Wed, 21 Oct 2020 18:17:42 +0200 Subject: [PATCH] Reload/Interaction - Fix 2 hemtt ingame errors (#7924) * fix 2 hemtt ingame errors * Extract broken calls to function * Update addons/interaction/functions/fnc_doRemoteControl.sqf Co-authored-by: Dystopian Co-authored-by: Dystopian --- addons/interaction/ACE_ZeusActions.hpp | 14 +--------- addons/interaction/XEH_PREP.hpp | 1 + .../functions/fnc_doRemoteControl.sqf | 25 +++++++++++++++++ addons/reload/CfgEventHandlers.hpp | 10 +------ addons/reload/XEH_PREP.hpp | 1 + addons/reload/functions/fnc_onTake.sqf | 27 +++++++++++++++++++ 6 files changed, 56 insertions(+), 22 deletions(-) create mode 100644 addons/interaction/functions/fnc_doRemoteControl.sqf create mode 100644 addons/reload/functions/fnc_onTake.sqf diff --git a/addons/interaction/ACE_ZeusActions.hpp b/addons/interaction/ACE_ZeusActions.hpp index 9fad6c819a..c05b6fe973 100644 --- a/addons/interaction/ACE_ZeusActions.hpp +++ b/addons/interaction/ACE_ZeusActions.hpp @@ -35,19 +35,7 @@ class ACE_ZeusActions { displayName = "$STR_A3_CfgVehicles_ModuleRemoteControl_F"; icon = "\A3\Modules_F_Curator\Data\portraitRemoteControl_ca.paa"; condition = QUOTE(ZEUS_ACTION_CONDITION && {-1 < (curatorSelected select 0) findIf {!isNull effectiveCommander _x}}); - statement = QUOTE( \ - private _units = curatorSelected select 0; \ - private _unit = _units param [ARR_2( \ - _units findIf { \ - side _x in [ARR_4(east,west,resistance,civilian)] \ - && !(isPlayer _x) \ - }, \ - objNull \ - )]; \ - bis_fnc_curatorObjectPlaced_mouseOver = [ARR_2('OBJECT',_unit)]; \ - private _rc = group _target createUnit [ARR_5('ModuleRemoteControl_F',[ARR_3(0,0,0)],[],0,'NONE')]; \ - _rc setVariable [ARR_2('BIS_fnc_initModules_disableAutoActivation',false)]; \ - ); + statement = QUOTE(call FUNC(doRemoteControl)); }; class GVAR(repair) { diff --git a/addons/interaction/XEH_PREP.hpp b/addons/interaction/XEH_PREP.hpp index 5fb57ce6df..a63bfc48f8 100644 --- a/addons/interaction/XEH_PREP.hpp +++ b/addons/interaction/XEH_PREP.hpp @@ -25,6 +25,7 @@ PREP(canPassMagazine); PREP(passMagazine); PREP(canBecomeLeader); PREP(doBecomeLeader); +PREP(doRemoteControl); PREP(canTapShoulder); PREP(tapShoulder); PREP(canPardon); diff --git a/addons/interaction/functions/fnc_doRemoteControl.sqf b/addons/interaction/functions/fnc_doRemoteControl.sqf new file mode 100644 index 0000000000..90cad9e49c --- /dev/null +++ b/addons/interaction/functions/fnc_doRemoteControl.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" +/* + * Author: SilentSpike, joko + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_interaction_fnc_onRemoteControl + * + * Public: No + */ + +private _units = curatorSelected select 0; +private _index = _units findIf { + (side _x) in [east, west, resistance, civilian] + && !(isPlayer _x) +}; +private _unit = _units param [_index, objNull]; +bis_fnc_curatorObjectPlaced_mouseOver = ["OBJECT", _unit]; +private _rc = (group _target) createUnit ["ModuleRemoteControl_F", [0,0,0], [], 0, "NONE"]; +_rc setVariable ["BIS_fnc_initModules_disableAutoActivation", false]; diff --git a/addons/reload/CfgEventHandlers.hpp b/addons/reload/CfgEventHandlers.hpp index 3b9b676ffb..8b6f0822ee 100644 --- a/addons/reload/CfgEventHandlers.hpp +++ b/addons/reload/CfgEventHandlers.hpp @@ -20,15 +20,7 @@ class Extended_PostInit_EventHandlers { class Extended_Take_EventHandlers { class CAManBase { class ACE_AmmoIndicatorReload { - clientTake = QUOTE( \ - params [ARR_3('_unit', '_container', '_item')]; \ - if ( \ - _unit == ACE_player \ - && {GVAR(DisplayText)} \ - && {_container in [ARR_3(uniformContainer _unit, vestContainer _unit, backpackContainer _unit)]} \ - && {_item == currentMagazine _unit} \ - ) then {_unit call DFUNC(displayAmmo)}; \ - ); + clientTake = QUOTE(_this call FUNC(onTake)); }; }; }; diff --git a/addons/reload/XEH_PREP.hpp b/addons/reload/XEH_PREP.hpp index 0a7fd80fbb..20fc53724e 100644 --- a/addons/reload/XEH_PREP.hpp +++ b/addons/reload/XEH_PREP.hpp @@ -4,4 +4,5 @@ PREP(canCheckAmmoSelf); PREP(getAmmoToLinkBelt); PREP(checkAmmo); PREP(displayAmmo); +PREP(onTake); PREP(startLinkingBelt); diff --git a/addons/reload/functions/fnc_onTake.sqf b/addons/reload/functions/fnc_onTake.sqf new file mode 100644 index 0000000000..9f379ff643 --- /dev/null +++ b/addons/reload/functions/fnc_onTake.sqf @@ -0,0 +1,27 @@ +#include "script_component.hpp" +/* + * Author: ? + * + * Arguments: + * 0: Unit + * 1: Container + * 2: Item + * + * Return Value: + * None + * + * Example: + * [bob, backpackContainer bob, "ACE_Banana"] call ace_reload_fnc_onTake + * + * Public: No + */ + +params ["_unit", "_container", "_item"]; +if ( + _unit == ACE_player + && {GVAR(DisplayText)} + && {_item == currentMagazine _unit} + && {_container in [uniformContainer _unit, vestContainer _unit, backpackContainer _unit]} +) then { + _unit call FUNC(displayAmmo); +};