mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Improve filterCheats and VON block
Filter cheats is now added to the main options menus that needed it.
It is not needed on the map (display 12) because KeyDown for display 46
also fires when it is open. So filterCheats was firing twice (once on
each display) in that case.
KeyDown does not fire on display 63 at all
regardless of whether PTT or VON is held down, toggled or chat open.
Keydown does fire on 55, but only after the mic icon is locked on, so it
is of limited use. MouseButtonDown does not fire on 55 or 63. So it is
useless to add to those displays. You can confirm this with:
(findDisplay 63) displayAddEventHandler ["KeyDown","systemchat
'fired';"];
Filter cheats is now only checked on display 46 when a
voice, channel, or cheat key is pressed instead of on every key press.
This still works 100% of the time for blocking cheat input. For
performance reasons it's probably not worth checking all the conditions
in filterCheats with every key press on display46 just for the VON
block. Doing so covers some edge combination bind cases better, so it
may be worth considering again if no better alternative is found. For
now this solution is good enough to cover the majority of cases without
slowing down the keyhandler during normal usage.
The VON message now
tells you exactly which channel block you triggered instead of listing
all of them.
Fixed issue mentioned in 52c9c7c with VON getting stuck on when using a
double tap keybind.
Tested:
1. Talk in side with regular/combo/mouse bind
2. Change channels
while mic is locked on with regular/combo/mouse bind
3. Change channels
with Up/Down arrows while chat is open.
4. Trying all cases in steps 1-3
with a dialog open.
It is possible to bypass the VON block with some different control
settings and combinations of the above, but for default controls and
common usage it works the majority of the time.
This commit is contained in:
@@ -162,6 +162,7 @@ if (!isDedicated) then {
|
||||
// EPOCH ADDITIONS
|
||||
autoRunOff = {autoRunActive = false; terminate autoRunThread; player playActionNow "Stop";};
|
||||
dog_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dog_findTargetAgent.sqf";
|
||||
dze_filterCheats = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_filterCheats.sqf";
|
||||
dze_isnearest_player = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_isNearestPlayer.sqf";
|
||||
dze_buildChecks = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_buildChecks.sqf";
|
||||
dze_requiredItemsCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_requiredItemsCheck.sqf";
|
||||
@@ -693,44 +694,6 @@ FNC_GetPos = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fnc_
|
||||
dayz_EjectPlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_ejectPlayer.sqf";
|
||||
dayz_groupInvite = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\handleInvite.sqf";
|
||||
|
||||
DZE_FilterCheats = {
|
||||
#include "\ca\editor\Data\Scripts\dikCodes.h"
|
||||
_dik = _this select 1;
|
||||
_shift = _this select 2;
|
||||
_voiceLocked = (ctrlShown ((FindDisplay 55) displayCtrl 101));
|
||||
_textBoxShown = (ctrlShown ((FindDisplay 24) displayCtrl 101));
|
||||
//we need to check inputAction as well since ArmA is soooooo reliable that dik codes don't work with double tap or combination ActionKey mappings...
|
||||
// Additionally inputAction does not work in dialogs, such as the escape menu, that are not the main display.
|
||||
_channelChange = ((_dik in DayZ_channelChangeKeys) || {(inputAction "PrevChannel") > 0} || {(inputAction "NextChannel") > 0});
|
||||
_inputActionCheck = ({(inputAction _x) > 0} count ["voiceOverNet","PushToTalk","PushToTalkAll","PushToTalkCommand","PushToTalkDirect","PushToTalkGroup","PushToTalkSide","PushToTalkVehicle"]) > 0;
|
||||
_isVoiceChat = ((_dik in dayz_voiceControls || _inputActionCheck) && {ctrlText (findDisplay 63 displayCtrl 101) in DZE_DisabledChannels}); //getting display directly from _this select 0 isn't reliable for chat channels!
|
||||
_ChannelChangeWithVoice = ((_voiceLocked && _channelChange) || {_voiceLocked && _textBoxShown && ((_dik == DIK_DOWN) || (_dik == DIK_UP))});
|
||||
if ((_dik == DIK_NUMPADMINUS && _shift) || _isVoiceChat || _ChannelChangeWithVoice) then {
|
||||
if (!_isVoiceChat) then {call player_forceSave;};
|
||||
disableUserInput true;disableUserInput true;
|
||||
[_isVoiceChat, _ChannelChangeWithVoice] spawn { //disable input, this is unfortunately the only way to stop cheat input
|
||||
_testTime = diag_tickTime;
|
||||
CheatsDisabled = _testTime;
|
||||
if (_this select 0 || _this select 1) then {
|
||||
if (_this select 0) then {
|
||||
titleText [(Format ["No voice chat in: %1", DZE_DisabledChannels]), "PLAIN", 1];
|
||||
} else {
|
||||
titleText ["You may not change chat channels while VON is active!", "PLAIN", 1];
|
||||
};
|
||||
uiSleep 2;
|
||||
} else {
|
||||
titleText ["DO NOT ENTER CHEATS, WAIT 5 SECONDS TO CONTINUE!", "PLAIN", 1];
|
||||
uiSleep 5;
|
||||
};
|
||||
if (!r_player_unconsciousInputDisabled && CheatsDisabled == _testTime) then {
|
||||
//weird disableuserInput behavior, enable input, disable and reenable to prevent the last key press being input after re-enable
|
||||
disableUserInput false;disableUserInput true;disableUserInput false;disableUserInput false;
|
||||
};
|
||||
};
|
||||
};
|
||||
(_isVoiceChat || _ChannelChangeWithVoice);
|
||||
};
|
||||
|
||||
player_sumMedical = {
|
||||
private["_character","_wounds","_legs","_arms","_medical","_status"];
|
||||
_character = _this;
|
||||
|
||||
Reference in New Issue
Block a user