From b9a5c5966038640e3dbd4cd13cb810d27e13f79c Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Fri, 25 Nov 2016 18:22:41 -0500 Subject: [PATCH] Include all controls in VON block Moved to display 46 keydown since keydown on 63 only fires after the VON transmission has already started (slight delay). Added mouseButtonDown so it can not be bypassed via assigning a mouse button. --- SQF/dayz_code/Configs/rscTitles.hpp | 2 +- SQF/dayz_code/compile/keyboard.sqf | 18 +++++++++++++++--- SQF/dayz_code/configVariables.sqf | 11 ++--------- SQF/dayz_code/init/compiles.sqf | 18 ++++++++---------- SQF/dayz_code/init/variables.sqf | 4 +++- 5 files changed, 29 insertions(+), 24 deletions(-) diff --git a/SQF/dayz_code/Configs/rscTitles.hpp b/SQF/dayz_code/Configs/rscTitles.hpp index bf15d3ee8..684d5fe9f 100644 --- a/SQF/dayz_code/Configs/rscTitles.hpp +++ b/SQF/dayz_code/Configs/rscTitles.hpp @@ -99,7 +99,7 @@ class RscDisplayChat class RscDisplayChannel { idd = 63; - onKeyDown = "_handle = if (!isNil 'DZE_FilterCheats') then {_this call DZE_FilterCheats;} else {false;}; _handle"; + onMouseButtonDown = "_handle = if (!isNil 'DZE_FilterCheats') then {[(_this select 1),false] call DZE_FilterCheats} else {false}; _handle"; class controls; }; class RscPictureGUI diff --git a/SQF/dayz_code/compile/keyboard.sqf b/SQF/dayz_code/compile/keyboard.sqf index 0e57f5a90..2b9a80e89 100644 --- a/SQF/dayz_code/compile/keyboard.sqf +++ b/SQF/dayz_code/compile/keyboard.sqf @@ -148,6 +148,13 @@ if (isNil "keyboard_keys") then { dayz_lastCheckBit = diag_ticktime; [player,20,true,(getPosATL player)] call player_alertZombies; }; + }; + _checkVoice = { + if (diag_ticktime - dayz_lastCheckBit > 10) then { + dayz_lastCheckBit = diag_ticktime; + [player,20,true,(getPosATL player)] call player_alertZombies; + }; + _handled = if (!isNil "DZE_FilterCheats") then {[-999,false] call DZE_FilterCheats} else {false}; }; _journal = { if (!dayz_isSwimming and !dialog) then { @@ -280,9 +287,14 @@ if (isNil "keyboard_keys") then { [actionKeys "MoveBack", _interrupt] call _addArray; [actionKeys "TurnLeft", _interrupt] call _addArray; [actionKeys "TurnRight", _interrupt] call _addArray; - [actionKeys "PushToTalk", _noise] call _addArray; - [actionKeys "VoiceOverNet", _noise] call _addArray; - [actionKeys "PushToTalkDirect", _noise] call _addArray; + [actionKeys "PushToTalk", _checkVoice] call _addArray; + [actionKeys "PushToTalkAll", _checkVoice] call _addArray; + [actionKeys "PushToTalkCommand", _checkVoice] call _addArray; + [actionKeys "PushToTalkDirect", _checkVoice] call _addArray; + [actionKeys "PushToTalkGroup", _checkVoice] call _addArray; + [actionKeys "PushToTalkSide", _checkVoice] call _addArray; + [actionKeys "PushToTalkVehicle", _checkVoice] call _addArray; + [actionKeys "VoiceOverNet", _checkVoice] call _addArray; [actionKeys "Chat", _noise] call _addArray; [actionKeys "User20", _journal] call _addArray; [actionKeys "Diary", _journal] call _addArray; diff --git a/SQF/dayz_code/configVariables.sqf b/SQF/dayz_code/configVariables.sqf index d20a7f47b..82f5184d0 100644 --- a/SQF/dayz_code/configVariables.sqf +++ b/SQF/dayz_code/configVariables.sqf @@ -33,7 +33,7 @@ DZE_NoBuildNear = []; //Array of object class names that are blacklisted to buil DZE_GemOccurance = [["ItemTopaz",10], ["ItemObsidian",8], ["ItemSapphire",6], ["ItemAmethyst",4], ["ItemEmerald",3], ["ItemCitrine",2], ["ItemRuby",1]]; //Sets how rare each gem is in the order shown when mining (whole numbers only) DZE_GodModeBaseExclude = []; //Array of object class names excluded from the god mode bases feature DZE_salvageLocked = true; //Enable or disable salvaging of locked vehicles, useful for stopping griefing on locked vehicles. -DZE_DisabledChannels = ["str_channel_side","str_channel_global","str_channel_command"]; //list of stringTable.xml definiitions to disable voice channels. available channels are: ["str_channel_side", "str_channel_group","str_channel_global","str_channel_direct","str_channel_command","str_channel_vehicle"] +DZE_DisabledChannels = [(localize "str_channel_side"),(localize "str_channel_global"),(localize "str_channel_command")]; //List of disabled voice channels. Other channels are: "str_channel_group","str_channel_direct","str_channel_vehicle" // Death Messages DZE_DeathMsgChat = "none"; //"none","global","side","system" Display death messages in selected chat channel. @@ -109,11 +109,4 @@ dayz_requireRadio = false; // Require players to have a radio on their toolbelt Variables that are map specific or frequently changed should be included in init.sqf by default with a corresponding if(isNil)then{}; in variables.sqf. -*/ - -//DO NOT TOUCH BELOW! We need to get local channel names that varry upon every player's selected language -DZE_LocalizedDisabledChannels = []; -{ - _localizedText = localize _x; - DZE_LocalizedDisabledChannels set [(count DZE_LocalizedDisabledChannels), _localizedText]; -} forEach DZE_DisabledChannels; \ No newline at end of file +*/ \ No newline at end of file diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 65ea9ed3f..d39595687 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -695,20 +695,19 @@ dayz_groupInvite = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups DZE_FilterCheats = { #define DIK_NUMPADMINUS 0x4A - #define DIK_CAPSLOCK 0x3A - disableSerialization; _dik = _this select 1; _shift = _this select 2; - _isVoiceChat = ((_dik == DIK_CAPSLOCK) && {(ctrlText ((findDisplay 63) displayCtrl 101)) in DZE_LocalizedDisabledChannels}); //getting display directly from _this select 0 isn't reliable for chat channels! + + _isVoiceChat = (_dik in dayz_voiceControls && {ctrlText (findDisplay 63 displayCtrl 101) in DZE_DisabledChannels}); //getting display directly from _this select 0 isn't reliable for chat channels! if ((_dik == DIK_NUMPADMINUS && _shift) || _isVoiceChat) then { - call player_forceSave; + if (!_isVoiceChat) then {call player_forceSave;}; disableUserInput true;disableUserInput true; - [_isVoiceChat] spawn { //disable input, this is unfortunately the only way to stop cheat input + _isVoiceChat spawn { //disable input, this is unfortunately the only way to stop cheat input _testTime = diag_tickTime; CheatsDisabled = _testTime; - if (_this select 0) then { - titleText [(Format ["No voice chat in: %1", DZE_LocalizedDisabledChannels]), "PLAIN", 1]; - uiSleep 1; + if (_this) then { + titleText [(Format ["No voice chat in: %1", DZE_DisabledChannels]), "PLAIN", 1]; + uiSleep 2; } else { titleText ["DO NOT ENTER CHEATS, WAIT 5 SECONDS TO CONTINUE!", "PLAIN", 1]; uiSleep 5; @@ -719,8 +718,7 @@ DZE_FilterCheats = { }; }; }; - _handle = if (_isVoiceChat) then {true;} else {false;}; - _handle; + _isVoiceChat }; player_sumMedical = { diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index 86cc87137..e5697c81e 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -684,7 +684,9 @@ if (!isDedicated) then { Dayz_freefall = [ time, 0, 0.1 ]; dayz_getout = objNull; dayz_getoutTime = 0; - dayz_HitBy = objNull; + dayz_HitBy = objNull; + dayz_voiceControls = [-999]; + {dayz_voiceControls = dayz_voiceControls + (actionKeys _x)} count ["VoiceOverNet","PushToTalk","PushToTalkAll","PushToTalkCommand","PushToTalkDirect","PushToTalkGroup","PushToTalkSide","PushToTalkVehicle"]; // EPOCH ADDITIONS if (isNil "DZE_BackpackAntiTheft") then {DZE_BackpackAntiTheft = false;};