Add sleep before refreshing controls

Vanilla commit:

e6e0d057dd
This commit is contained in:
ebaydayz
2016-10-29 15:52:55 -04:00
parent fda831bf4f
commit 0be3a8522e
7 changed files with 66 additions and 16 deletions

View File

@@ -165,18 +165,6 @@ if (isNil "keyboard_keys") then {
_handled = true;
};};
};
_turbo = {
if (vehicle player == player) then {
//Prevent easily outrunning zeds and bypassing Arma sprint fatigue (slow to normal running speed after a time) by holding turbo and spamming W
_handled = true;
};
};
_holdBreath = {
if (count (actionKeys "HoldBreath") > 1) then {
systemChat localize "STR_UI_HOLD_BREATH";
_handled = true;
};
};
_forcesave = {
dayz_lastCheckBit = diag_ticktime;
call player_forceSave;
@@ -346,8 +334,6 @@ if (isNil "keyboard_keys") then {
[actionKeys "User20", _journal] call _addArray;
[actionKeys "Diary", _journal] call _addArray;
[actionKeys "NetworkStats", _journal] call _addArray;
[actionKeys "Turbo", _turbo] call _addArray;
[actionKeys "HoldBreath", _holdBreath] call _addArray;
[[DIK_F1], _muteSound] call _addArray;
//[[DIK_F4, DIK_TAB, DIK_DELETE], _forcesave] call _addArray;
//[[DIK_F4, DIK_RMENU, DIK_LMENU,DIK_LSHIFT,DIK_RSHIFT,DIK_ESCAPE], _forcesave2] call _addArray;

View File

@@ -0,0 +1,23 @@
private ["_holdBreath","_turboKey"];
//Sleep required for actionKeys to update after controls dialog closes
uiSleep 1;
//Refresh keyboard_keys after controls change
if (_this) then {
keyboard_keys = nil;
[controlNull,1,false,false,false] call DZ_KeyDown_EH;
};
//ActionKeys includes mouse button and joystick binds
_holdBreath = if (count (actionKeys "HoldBreath") > 1) then { [true,localize "STR_UI_HOLD_BREATH"] } else { [false,""] };
//Prevent easily outrunning zeds and bypassing Arma sprint fatigue (slow to normal running speed after a time) by holding turbo and spamming W
_turboKey = if (count (actionKeys "Turbo") > 0) then { [true,localize "STR_UI_HOLD_TURBO"] } else { [false,""] };
if ((_holdBreath select 0) or (_turboKey select 0)) then {
85000 cutRsc ["DZ_BlackScreen","PLAIN"];
(uiNamespace getVariable "DZ_BlackScreen") displayCtrl 1 ctrlSetText format ["%1\n%2", (_holdBreath select 1), (_turboKey select 1)];
} else {
85000 cutText ["","PLAIN"];
};