mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #309 from KoffeinFlummi/closeInteractMenu
Close interact menu when knocked out
This commit is contained in:
commit
5f4030469f
@ -16,8 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_2(_unit,_isUnconc);
|
EXPLODE_2_PVT(_this,_unit,_isUnconc);
|
||||||
|
|
||||||
|
diag_log "handleOnUnconscious";
|
||||||
|
diag_log _this;
|
||||||
|
diag_log _unit;
|
||||||
if (!local _unit) exitWith {};
|
if (!local _unit) exitWith {};
|
||||||
|
|
||||||
if (_isUnconc) then {
|
if (_isUnconc) then {
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
_eventName = _this select 0;
|
PARAMS_2(_eventName,_eventArgs);
|
||||||
_eventArgs = _this select 1;
|
|
||||||
|
|
||||||
_eventNames = GVAR(events) select 0;
|
_eventNames = GVAR(events) select 0;
|
||||||
_eventIndex = _eventNames find _eventName;
|
_eventIndex = _eventNames find _eventName;
|
||||||
|
@ -18,11 +18,37 @@ addMissionEventHandler ["Draw3D", DFUNC(render)];
|
|||||||
|
|
||||||
|
|
||||||
["ACE3", QGVAR(InteractKey), (localize "STR_ACE_Interact_Menu_InteractKey"),
|
["ACE3", QGVAR(InteractKey), (localize "STR_ACE_Interact_Menu_InteractKey"),
|
||||||
{[0] call FUNC(keyDown)},
|
{
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
// Statement
|
||||||
|
[0] call FUNC(keyDown)
|
||||||
|
},
|
||||||
{[0] call FUNC(keyUp)},
|
{[0] call FUNC(keyUp)},
|
||||||
[219, [false, false, false]], false] call cba_fnc_addKeybind; //Left Windows Key
|
[219, [false, false, false]], false] call cba_fnc_addKeybind; //Left Windows Key
|
||||||
|
|
||||||
["ACE3", QGVAR(SelfInteractKey), (localize "STR_ACE_Interact_Menu_SelfInteractKey"),
|
["ACE3", QGVAR(SelfInteractKey), (localize "STR_ACE_Interact_Menu_SelfInteractKey"),
|
||||||
{[1] call FUNC(keyDown)},
|
{
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
// Statement
|
||||||
|
[1] call FUNC(keyDown)
|
||||||
|
},
|
||||||
{[1] call FUNC(keyUp)},
|
{[1] call FUNC(keyUp)},
|
||||||
[219, [false, true, false]], false] call cba_fnc_addKeybind; //Left Windows Key + Ctrl/Strg
|
[219, [false, true, false]], false] call cba_fnc_addKeybind; //Left Windows Key + Ctrl/Strg
|
||||||
|
|
||||||
|
|
||||||
|
// Listens for the falling unconscious event, just in case the menu needs to be closed
|
||||||
|
["medical_onUnconscious", {
|
||||||
|
diag_log ["im_onUn 1:",_this];
|
||||||
|
// If no menu is open just quit
|
||||||
|
if (GVAR(openedMenuType) < 0) exitWith {};
|
||||||
|
|
||||||
|
EXPLODE_2_PVT(_this,_unit,_isUnconscious);
|
||||||
|
|
||||||
|
if (_unit != ACE_player || !_isUnconscious) exitWith {};
|
||||||
|
|
||||||
|
GVAR(actionSelected) = false;
|
||||||
|
[] call FUNC(keyUp);
|
||||||
|
diag_log ["im_onUn 2:",_this];
|
||||||
|
}] call EFUNC(common,addEventhandler);
|
||||||
|
@ -240,3 +240,7 @@ if (USE_WOUND_EVENT_SYNC) then {
|
|||||||
{((_this select 0) getvariable ["ACE_isDead", false])},
|
{((_this select 0) getvariable ["ACE_isDead", false])},
|
||||||
{(((_this select 0) getvariable [QGVAR(airwayStatus), 100]) < 80)}
|
{(((_this select 0) getvariable [QGVAR(airwayStatus), 100]) < 80)}
|
||||||
] call FUNC(addUnconsciousCondition);
|
] call FUNC(addUnconsciousCondition);
|
||||||
|
|
||||||
|
// Prevent all types of interaction while unconscious
|
||||||
|
// @todo: probably remove this when CBA keybind hold key works properly
|
||||||
|
["isNotUnconscious", {!((_this select 0) getVariable ["ACE_isUnconscious", false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||||
|
Loading…
Reference in New Issue
Block a user