mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
disable firing if menu is opened
This commit is contained in:
parent
7ad9238bbf
commit
d6a293c573
@ -74,3 +74,6 @@ GVAR(isOpeningDoor) = false;
|
||||
[29, [false, false, false]], false] call cba_fnc_addKeybind;
|
||||
|
||||
["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition);
|
||||
|
||||
// disable firing while the interact menu is is is opened
|
||||
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventHandler);
|
||||
|
@ -14,6 +14,7 @@ PREP(getDoor);
|
||||
PREP(getDoorAnimations);
|
||||
PREP(getDown);
|
||||
PREP(getSelectedButton);
|
||||
PREP(handlePlayerChanged);
|
||||
PREP(hideMenu);
|
||||
PREP(hideMouseHint);
|
||||
PREP(isInRange);
|
||||
|
31
addons/interaction/functions/fnc_handlePlayerChanged.sqf
Normal file
31
addons/interaction/functions/fnc_handlePlayerChanged.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Disables firing while the menu is opened. Called from playerChanged eh.
|
||||
*
|
||||
* Argument:
|
||||
* 0: New unit to add the addAction eh (Object)
|
||||
* 1: Old unit to remove the addAction eh (String)
|
||||
*
|
||||
* Return value:
|
||||
* NOPE
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_newUnit", "_oldUnit"];
|
||||
|
||||
_newUnit = _this select 0;
|
||||
_oldUnit = _this select 1;
|
||||
|
||||
// add to new unit
|
||||
private "_ehid";
|
||||
_ehid = [_newUnit, "DefaultAction", {EGVAR(interact_menu,openedMenuType) >= 0}, {systemChat "snap"}] call EFUNC(common,addActionEventHandler);
|
||||
|
||||
_newUnit setVariable [QGVAR(AAEHID), _ehid];
|
||||
|
||||
// remove from old unit
|
||||
_ehid = _oldUnit getVariable [QGVAR(AAEHID), -1];
|
||||
|
||||
[_oldUnit, "DefaultAction", _ehid] call EFUNC(common,removeActionEventHandler);
|
||||
|
||||
_oldUnit setVariable [QGVAR(AAEHID), -1];
|
Loading…
Reference in New Issue
Block a user