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:
ebaydayz
2016-03-01 22:34:36 -05:00
parent ca44e9d8b1
commit 959507bfc7
6 changed files with 28 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
[NEW] Auto login when a player joins the server, default 10 seconds, requires description.ext update in the mission (disable in description.ext by setting defValueParam1 = 31;) @icomrade
[NEW] Upgraded (_DZE1,2,3,4) ArmoredSUV and Kamaz classes are now available. #1518 #1538 @McKeighan
[NEW] Optional news/rules feed on player login from DayZ Mod, set dayz_enableRules in init.sqf #1673 @ebaydayz
[NEW] Autorun hotkey (0 = Toggle auto run) @ebaydayz
[NEW] Weapon switch hotkeys (1 = primary, 2 = pistol, 3 = melee) from DayZ Mod #1673 @ebaydayz
[NEW] Added waves effect during stormy weather #974 @FramedYannick @ebaydayz
[NEW] Optional variable to restrict wearable clothes. Add DZE_RestrictSkins to init.sqf #1560 @BetterDeadThanZed @ebaydayz

View File

@@ -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;

View File

@@ -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";

View File

@@ -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 {

View File

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

View File

@@ -835,4 +835,5 @@ if(!isDedicated) then {
DZE_SaveTime = 30;
Dayz_constructionContext = [];
autoRunActive = 0;
};