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

@@ -357,6 +357,40 @@ class RscTitles
};
};
};
class DZ_BlackScreen {
idd = -1;
movingEnable = 0;
enableSimulation = 1;
enableDisplay = 1;
onLoad = "uiNamespace setVariable ['DZ_BlackScreen', _this select 0];";
duration = 99999999999999999;
fadein = 0;
fadeout = 0;
class controls {
class Background: RscText {
idc = -1;
x = safezoneX;
y = safezoneY;
w = safezoneW;
h = safezoneH;
text = "";
colorText[] = {0,0,0,0};
colorBackground[] = {0,0,0,1};
};
class Text: RscText {
idc = 1;
x = 0.3 * safezoneW + safezoneX;
y = 0.859137 * safezoneH + safezoneY;
w = 0.400445 * safezoneW;
h = 0.139148 * safezoneH;
text = "";
style = 0x02 + 0x10 + 0x200;
lineSpacing = 1;
sizeEx = 0.034;
};
};
};
class playerStatusGUI_epoch {
idd = 690000;

View File

@@ -41,7 +41,7 @@ class RscDisplayMission: RscDisplayEmpty
onKeyDown = "if (!isNil 'DZ_KeyDown_EH') then {_this call DZ_KeyDown_EH;};"; //assigned much quicker than spawning init_keyboard
};
class RscDisplayConfigure {
onUnload = "if (!isNil 'keyboard_keys') then {keyboard_keys = nil; [controlNull,1,false,false,false] call DZ_KeyDown_EH;};"; //refresh keyboard_keys after changing binds
onUnload = "if (!isNil 'updateControlsHandle') then {terminate updateControlsHandle;}; if (!isNil 'ui_updateControls') then {updateControlsHandle = true spawn ui_updateControls;};";
class controlsBackground;
class controls;
};

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"];
};

View File

@@ -133,6 +133,7 @@ if (!isDedicated) then {
player_gearSet = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSet.sqf";
ui_changeDisplay = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_changeDisplay.sqf";
ui_gear_sound = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_gear_sound.sqf";
ui_updateControls = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_updateControls.sqf";
//playerstats
horde_epeen_fnc_fill_page = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\fill_page_fnc.sqf";
@@ -938,4 +939,4 @@ dayz_engineSwitch = {
PVDZ_send = [_vehicle,"SetEngineState",[_vehicle,_state]];
publicVariableServer "PVDZ_send";
};
};
};

View File

@@ -7784,6 +7784,9 @@
<English>Please change your controls. HoldBreath holds too many keys and has been blocked.</English>
<German>Bitte ändere deine Steuerung. "Luft anhalten" liegt auf mehr als einer Taste und wurde blockiert.</German>
</Key>
<Key ID="STR_UI_HOLD_TURBO">
<English>Please change your controls. Turbo holds too many keys and has been blocked.</English>
</Key>
<Key ID="STR_UI_STREAMER_MODE">
<English>Streamer mode:</English>
<German>Streamer Modus:</German>

View File

@@ -1208,6 +1208,9 @@ class FSM
itemno = 32;
init = /*%FSM<STATEINIT""">*/"diag_log 'player_forceSave called from fsm';" \n
"//call player_forceSave;" \n
"" \n
"//Check for bad controls at login" \n
"false spawn ui_updateControls;" \n
"" \n
"publicVariableServer ""PVDZ_plr_LoginRecord"";"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;