Update keyboard.sqf and block backspace by default

This commit is contained in:
A Man
2020-05-18 14:19:54 +02:00
parent 550a6218f7
commit f2afd7ffaf

View File

@@ -2,6 +2,8 @@
#include "\ca\editor\Data\Scripts\dikCodes.h"
private ["_dikCode","_shiftState","_ctrlState","_altState","_handled","_cancelBuild","_dze_f","_dze_q","_dze_z","_autoRun","_filterCheat","_openGroups","_muteSound","_statusUI","_rifle","_pistol","_melee","_surrender","_gear","_forcesave","_drop","_interrupt","_noise","_journal","_build_left","_build_right","_build_str8OnOff","_block","_addArray","_code"];
_dikCode = _this select 1;
_shiftState = _this select 2;
_ctrlState = _this select 3;
@@ -16,27 +18,29 @@ if (isNil "keyboard_keys") then {
if (r_player_dead) then {_handled = true;}; // Disable ESC after death
};
_dze_f = {
if (!_ctrlState && !_altState) then {DZE_F = true;};
if (!_ctrlState && {!_altState}) then {DZE_F = true;};
};
_dze_q = {
if (!_ctrlState && !_altState) then {DZE_Q = true;};
if (!_ctrlState && _altState) then {DZE_Q_alt = true;};
if (_ctrlState && !_altState) then {DZE_Q_ctrl = true;};
if (!_ctrlState && {!_altState}) then {DZE_Q = true;};
if (!_ctrlState && {_altState}) then {DZE_Q_alt = true;};
if (_ctrlState && {!_altState}) then {DZE_Q_ctrl = true;};
};
_dze_z = {
if (!_ctrlState && !_altState) then {DZE_Z = true;};
if (!_ctrlState && _altState) then {DZE_Z_alt = true;};
if (_ctrlState && !_altState) then {DZE_Z_ctrl = true;};
if (!_ctrlState && {!_altState}) then {DZE_Z = true;};
if (!_ctrlState && {_altState}) then {DZE_Z_alt = true;};
if (_ctrlState && {!_altState}) then {DZE_Z_ctrl = true;};
};
_autoRun = {
if (!dayz_autoRun) then {
dayz_autoRun = true;
dayz_autoRunThread = [] spawn {
private "_weapon";
_weapon = currentWeapon player;
while {dayz_autoRun} do {
// SurfaceIsWater does not work for ponds
// Check weapon to detect Arma action (dayz action is handled in dz_fn_switchWeapon)
if (player != vehicle player or (surfaceIsWater getPosASL player) or ((call fn_nearWaterHole) select 0) or (currentWeapon player != _weapon) or r_fracture_legs) exitWith {
if (player != vehicle player or {r_fracture_legs} or {surfaceIsWater getPosASL player} or {currentWeapon player != _weapon} or {(call fn_nearWaterHole) select 0}) exitWith {
call dayz_autoRunOff;
};
player playAction "FastF";
@@ -53,7 +57,7 @@ if (isNil "keyboard_keys") then {
_handled = [displayNull,_dikCode,_shiftState] call dze_filterCheats;
};
_openGroups = {
if (dayz_requireRadio && !("ItemRadio" in items player)) then {
if (dayz_requireRadio && {!("ItemRadio" in items player)}) then {
localize "STR_EPOCH_NEED_RADIO" call dayz_rollingMessages;
} else {
if (isNull findDisplay 80000) then {
@@ -129,26 +133,30 @@ if (isNil "keyboard_keys") then {
_handled = true;
};
_gear = {
if ((vehicle player != player) and !_shiftState and !_ctrlState and !_altState && !dialog) then {
if ((vehicle player != player) && {!_shiftState} && {!_ctrlState} && {!_altState} && {!dialog}) then {
createGearDialog [player, "RscDisplayGear"];
_handled = true;
}
else { if ((vehicle player == player) and (speed vehicle player > 0)) then {
//[objNull, player, rSwitchMove,""] call RE;
_handled = true;
};};
} else {
if ((vehicle player == player) && {speed vehicle player > 0}) then {
//[objNull, player, rSwitchMove,""] call RE;
_handled = true;
};
};
};
_forcesave = {
if (diag_tickTime - dayz_lastSave > 10) then {
call player_forceSave;
};
};
/*
_forcesave2 = {
if ((!isNull (findDisplay 106)) OR dialog) then {
call player_forceSave;
};
};
*/
_drop = {
private "_doors";
if (r_drag_sqf) then {
_doors = nearestObjects [player, DayZ_DropDrageeObjects, 3]; //Prevent dropping dragged player through objects
if (count _doors > 0) then {_handled = true;};
@@ -168,13 +176,13 @@ if (isNil "keyboard_keys") then {
//Overriding default engine handling does not stop combination binds, need manual disableUserInput too
_handled = [displayNull,_dikCode,_shiftState] call dze_filterCheats;
if (diag_ticktime - dayz_lastCheckBit > 10 && !(_dikCode in channel_keys)) then {
if (diag_ticktime - dayz_lastCheckBit > 10 && {!(_dikCode in channel_keys)}) then {
dayz_lastCheckBit = diag_ticktime;
[player,20,true,(getPosATL player)] call player_alertZombies;
};
};
_journal = {
if (!dayz_isSwimming and !dialog) then {
if (!dayz_isSwimming && {!dialog}) then {
[player,4,true,(getPosATL player)] call player_alertZombies;
createDialog 'horde_journal_front_cover';
};
@@ -185,6 +193,8 @@ if (isNil "keyboard_keys") then {
DZE_4 = true;
// fence construction
if (0 != count Dayz_constructionContext) then {
private ["_angleRef", "_dir","_new"];
_angleRef = Dayz_constructionContext select 1;
_dir = _angleRef - (getDir player) -5;
if (_dir > 180) then {_dir = _dir - 360};
@@ -201,6 +211,8 @@ if (isNil "keyboard_keys") then {
_build_right = {
DZE_6 = true;
if (0 != count Dayz_constructionContext) then {
private ["_angleRef", "_dir","_new"];
_angleRef = Dayz_constructionContext select 1;
_dir = _angleRef - (getDir player) +5;
if (_dir > 180) then { _dir = _dir - 360; };
@@ -230,6 +242,8 @@ if (isNil "keyboard_keys") then {
if (player isKindOf "PZombie_VB") then {
_handled = true; // do not allow player zombies to vault or jump
} else {
private "_nearbyObjects";
_nearbyObjects = nearestObjects [getPosATL player, dayz_disallowedVault, 8];
if (count _nearbyObjects > 0) then {
if (diag_tickTime - dayz_lastCheckBit > 4) then {
@@ -324,7 +338,7 @@ if (isNil "keyboard_keys") then {
[[ DIK_F9,DIK_F10,DIK_F11,DIK_F12,
DIK_F8,DIK_F7,DIK_F6,DIK_F5,
DIK_F2,DIK_9,
DIK_8,DIK_7,DIK_6,DIK_5,DIK_4], _block] call _addArray;
DIK_8,DIK_7,DIK_6,DIK_5,DIK_4,DIK_BACK], _block] call _addArray;
if (dayz_groupSystem) then {
[[DIK_F5], _openGroups] call _addArray;
[[DIK_LWIN,DIK_RWIN], {dayz_groupNameTags = !dayz_groupNameTags;_handled = true;}] call _addArray;