2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Disables key input. ESC can still be pressed to open the menu.
|
|
|
|
*
|
2015-04-11 17:52:30 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: True to disable key inputs, false to re-enable them <BOOL>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2015-09-20 20:16:51 +00:00
|
|
|
* Return Value:
|
|
|
|
* None
|
2015-04-11 17:52:30 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [true] call ace_common_fnc_disableUserInput
|
|
|
|
*
|
2015-09-20 20:16:51 +00:00
|
|
|
* Public: No
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
|
|
|
|
2015-09-20 20:16:51 +00:00
|
|
|
params ["_state"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (_state) then {
|
2015-04-11 17:52:30 +00:00
|
|
|
disableSerialization;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-04-11 17:52:30 +00:00
|
|
|
if (!isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull])) exitWith {};
|
2015-09-20 20:16:51 +00:00
|
|
|
if (!isNil QGVAR(disableInputPFH)) exitWith {};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-04-11 17:52:30 +00:00
|
|
|
// end TFAR and ACRE2 radio transmissions
|
|
|
|
call FUNC(endRadioTransmission);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-04-11 17:52:30 +00:00
|
|
|
// Close map
|
|
|
|
if (visibleMap && {!(player getVariable ["ACE_canSwitchUnits", false])}) then {
|
|
|
|
openMap false;
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-04-11 17:52:30 +00:00
|
|
|
closeDialog 0;
|
|
|
|
createDialog QGVAR(DisableMouse_Dialog);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _dlg = uiNamespace getVariable QGVAR(dlgDisableMouse);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-04-11 17:52:30 +00:00
|
|
|
_dlg displayAddEventHandler ["KeyDown", {
|
2015-09-20 20:16:51 +00:00
|
|
|
params ["", "_key"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-04-11 17:52:30 +00:00
|
|
|
if (_key == 1 && {alive player}) then {
|
|
|
|
createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer);
|
|
|
|
|
|
|
|
disableSerialization;
|
2015-09-20 20:16:51 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _dlg = findDisplay 49;
|
2015-04-11 17:52:30 +00:00
|
|
|
|
|
|
|
for "_index" from 100 to 2000 do {
|
|
|
|
(_dlg displayCtrl _index) ctrlEnable false;
|
|
|
|
};
|
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _ctrl = _dlg displayctrl 103;
|
2015-04-11 17:52:30 +00:00
|
|
|
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(while {!isNull (uiNamespace getVariable [ARR_2(QUOTE(QGVAR(dlgDisableMouse)),displayNull)])} do {closeDialog 0}; failMission 'LOSER'; [false] call DFUNC(disableUserInput);)];
|
|
|
|
_ctrl ctrlEnable true;
|
|
|
|
_ctrl ctrlSetText "ABORT";
|
|
|
|
_ctrl ctrlSetTooltip "Abort.";
|
|
|
|
|
|
|
|
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
|
|
|
|
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)];
|
2015-12-12 15:48:54 +00:00
|
|
|
_ctrl ctrlEnable (call {private _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
|
2015-04-11 17:52:30 +00:00
|
|
|
_ctrl ctrlSetText "RESPAWN";
|
|
|
|
_ctrl ctrlSetTooltip "Respawn.";
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then {
|
2015-04-11 18:05:22 +00:00
|
|
|
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
2015-09-20 20:16:51 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _acc = accTime;
|
2015-04-11 18:05:22 +00:00
|
|
|
teamSwitch;
|
|
|
|
setAccTime _acc;
|
|
|
|
};
|
2015-04-11 17:52:30 +00:00
|
|
|
|
2015-09-20 20:16:51 +00:00
|
|
|
if (_key in actionKeys "CuratorInterface" && {getAssignedCuratorLogic player in allCurators}) then {
|
2015-04-11 18:05:22 +00:00
|
|
|
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
|
|
|
openCuratorInterface;
|
2015-04-11 17:52:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (_key in actionKeys "ShowMap" && {player getVariable ["ACE_canSwitchUnits", false]}) then {
|
2015-04-11 18:05:22 +00:00
|
|
|
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
|
|
|
openMap true;
|
2015-04-11 17:52:30 +00:00
|
|
|
};
|
|
|
|
|
2015-08-08 18:08:27 +00:00
|
|
|
if (isServer || {serverCommandAvailable "#kick"} || {player getVariable ["ACE_isUnconscious", false] && {(call FUNC(player)) getVariable [QEGVAR(medical,AllowChatWhileUnconscious), missionNamespace getVariable [QEGVAR(medical,AllowChatWhileUnconscious), false]]}}) then {
|
2015-04-11 17:52:30 +00:00
|
|
|
if (!(_key in (actionKeys "DefaultAction" + actionKeys "Throw")) && {_key in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) then {
|
|
|
|
_key = 0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
_key > 0
|
|
|
|
}];
|
|
|
|
|
|
|
|
_dlg displayAddEventHandler ["KeyUp", {true}];
|
|
|
|
|
2015-09-21 20:41:29 +00:00
|
|
|
GVAR(disableInputPFH) = [{
|
2015-04-11 17:52:30 +00:00
|
|
|
if (isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) && {!visibleMap && isNull findDisplay 49 && isNull findDisplay 312 && isNull findDisplay 632}) then {
|
2015-09-21 20:41:29 +00:00
|
|
|
[GVAR(disableInputPFH)] call CBA_fnc_removePerFrameHandler;
|
|
|
|
GVAR(disableInputPFH) = nil;
|
2015-04-11 17:52:30 +00:00
|
|
|
[true] call FUNC(disableUserInput);
|
|
|
|
};
|
2015-09-21 20:41:29 +00:00
|
|
|
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
2015-01-11 16:42:31 +00:00
|
|
|
} else {
|
2015-09-21 20:41:29 +00:00
|
|
|
if (!isNil QGVAR(disableInputPFH)) then {
|
|
|
|
[GVAR(disableInputPFH)] call CBA_fnc_removePerFrameHandler;
|
|
|
|
GVAR(disableInputPFH) = nil;
|
2015-04-11 17:52:30 +00:00
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-04-11 17:52:30 +00:00
|
|
|
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|