mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Add autorun hotkey
Tested while autorunning: - getting knocked out - breaking legs - running into water - getting into and out of vehicles - climbing a ladder - dying - antiTP enabled - running up steep hills - as player zombie Everything works as expected. This does allow you to run up and down pretty steep hills, but if you try to scale something too steep you will break your legs as expected.
This commit is contained in:
@@ -19,6 +19,7 @@ if ((!r_player_handler1) && (r_handlerCount == 0)) then {
|
||||
0 fadeSound 0.05;
|
||||
disableUserInput true;
|
||||
_disableHdlr = [] spawn { uiSleep 2; disableUserInput true; r_player_unconsciousInputDisabled = true; };
|
||||
autoRunActive = 0;
|
||||
while {r_player_unconscious} do {
|
||||
_ctrl1 ctrlSetPosition [(_ctrl1Pos select 0),(_ctrl1Pos select 1),(_ctrl1Pos select 2),((0.136829 * safezoneH) * (1 -(r_player_timeout / _totalTimeout)))];
|
||||
_ctrl1 ctrlCommit 1;
|
||||
|
||||
@@ -32,6 +32,21 @@ if (isNil "keyboard_keys") then {
|
||||
if (!_ctrlState && _altState) then {DZE_Z_alt = true;};
|
||||
if (_ctrlState && !_altState) then {DZE_Z_ctrl = true;};
|
||||
};
|
||||
_autoRun = {
|
||||
if (autoRunActive == 0) then {
|
||||
autoRunActive = 1;
|
||||
autoRunThread = [] spawn {
|
||||
while {autoRunActive == 1} do {
|
||||
if ((player != vehicle player) or (surfaceIsWater (getPosASL player)) or r_fracture_legs) exitWith {call autoRunOff;};
|
||||
player playAction "FastF";
|
||||
uiSleep 0.5;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
call autoRunOff;
|
||||
};
|
||||
_handled = true;
|
||||
};
|
||||
_rifle = {
|
||||
["rifle"] spawn player_switchWeapon;
|
||||
_handled = true;
|
||||
@@ -162,6 +177,7 @@ if (isNil "keyboard_keys") then {
|
||||
_interrupt = {
|
||||
r_interrupt = true;
|
||||
if (DZE_Surrender) then {call dze_surrender_off};
|
||||
if (autoRunActive == 1) then {call autoRunOff;};
|
||||
};
|
||||
// TODO: left/right, when gear open: onKeyDown = "[_this,'onKeyDown',0,107,0,107] execVM '\z\addons\dayz_code\system\handleGear.sqf'";
|
||||
_noise = {
|
||||
@@ -272,6 +288,7 @@ if (isNil "keyboard_keys") then {
|
||||
[[DIK_NEXT], _dze_z] call _addArray;
|
||||
[[DIK_Q], {DZE_4 = true;}] call _addArray;
|
||||
[[DIK_E], {DZE_6 = true;}] call _addArray;
|
||||
[[DIK_0], _autoRun] call _addArray;
|
||||
[[DIK_SPACE], {DZE_5 = true;}] call _addArray;
|
||||
[actionKeys "User6", {DZE_F = true;}] call _addArray;
|
||||
[actionKeys "User7", {DZE_Q_ctrl = true;}] call _addArray;
|
||||
@@ -314,7 +331,7 @@ if (isNil "keyboard_keys") then {
|
||||
[actionKeys "ForceCommandingMode", {DZE_5 = true;_handled = true;}] call _addArray;
|
||||
[[ DIK_F9,DIK_F10,DIK_F11,DIK_F12,
|
||||
DIK_F8,DIK_F7,DIK_F6,DIK_F5,DIK_F4,
|
||||
DIK_F3,DIK_F2,DIK_F1,DIK_0,DIK_9,
|
||||
DIK_F3,DIK_F2,DIK_F1,DIK_9,
|
||||
DIK_8,DIK_7,DIK_6,DIK_5,DIK_4], _block] call _addArray;
|
||||
|
||||
(findDisplay 46) displayRemoveAllEventHandlers "KeyUp";
|
||||
|
||||
@@ -41,6 +41,7 @@ player setVariable ["medForceUpdate",true,true];
|
||||
player setVariable ["startcombattimer", 0];
|
||||
r_player_unconscious = false;
|
||||
r_player_cardiac = false;
|
||||
autoRunActive = 0;
|
||||
|
||||
_array = _this;
|
||||
if (count _array > 0) then {
|
||||
|
||||
@@ -379,6 +379,12 @@ if (!isDedicated) then {
|
||||
player setVariable ["DZE_Surrendered", false, true];
|
||||
DZE_Surrender = false;
|
||||
};
|
||||
|
||||
autoRunOff = {
|
||||
autoRunActive = 0;
|
||||
terminate autoRunThread;
|
||||
player playActionNow "Stop";
|
||||
};
|
||||
|
||||
gear_ui_init = {
|
||||
private["_control","_parent","_menu","_dspl","_grpPos"];
|
||||
|
||||
@@ -835,4 +835,5 @@ if(!isDedicated) then {
|
||||
|
||||
DZE_SaveTime = 30;
|
||||
Dayz_constructionContext = [];
|
||||
autoRunActive = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user