diff --git a/addons/captives/functions/fnc_handleOnUnconscious.sqf b/addons/captives/functions/fnc_handleOnUnconscious.sqf index 6d5ba1f47c..1924b6bb47 100644 --- a/addons/captives/functions/fnc_handleOnUnconscious.sqf +++ b/addons/captives/functions/fnc_handleOnUnconscious.sqf @@ -16,8 +16,11 @@ */ #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 (_isUnconc) then { diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index 501cc9eb91..8d6ef78a79 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -18,11 +18,37 @@ addMissionEventHandler ["Draw3D", DFUNC(render)]; ["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)}, [219, [false, false, false]], false] call cba_fnc_addKeybind; //Left Windows Key ["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)}, [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); diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 10926634dd..7939d5a353 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -240,3 +240,7 @@ if (USE_WOUND_EVENT_SYNC) then { {((_this select 0) getvariable ["ACE_isDead", false])}, {(((_this select 0) getvariable [QGVAR(airwayStatus), 100]) < 80)} ] 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);