mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
AutoRun
- Default Key is "W" - You can change the key in EPOCH ESC Menu - If choosen key is same as "moveforward" (default), you have to 2x tap it, else you only have to 1x tap it - If your legs are broken, you get a hint "can not autorun - legs are broken" - If the terrain is too steep, you only walk in AutoRun - Inside Water, you can not Autorun
This commit is contained in:
parent
9911f1284c
commit
096f03e7b9
66
Sources/epoch_code/compile/EPOCH_AutoRun.sqf
Normal file
66
Sources/epoch_code/compile/EPOCH_AutoRun.sqf
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
Author: [Ignatz] He-Man
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Autorun script
|
||||||
|
|
||||||
|
Licence:
|
||||||
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
||||||
|
|
||||||
|
Github:
|
||||||
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_AutoRun.sqf
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_myheight","_nextpos","_newheight"];
|
||||||
|
|
||||||
|
// _EPOCH_Autorunspeed is NOT a private variable, it is defined in Masterloop init!
|
||||||
|
|
||||||
|
_myheight = (getposasl player) select 2;
|
||||||
|
_nextpos = player modelToWorld [0,1,0];
|
||||||
|
_nextpos set [2,0];
|
||||||
|
_newheight = (atltoasl _nextpos) select 2;
|
||||||
|
if (surfaceiswater position player || ((getposatl player) select 2) > 0.5) then {
|
||||||
|
_newheight = _myheight;
|
||||||
|
};
|
||||||
|
if (_myheight-_newheight > 0.8 || _myheight-_newheight < -0.6) then {
|
||||||
|
if (_EPOCH_Autorunspeed != 1) then {
|
||||||
|
player playActionnow 'PlayerWalkF';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
player playAction 'PlayerWalkF';
|
||||||
|
};
|
||||||
|
_EPOCH_Autorunspeed = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (_myheight-_newheight > 0.5 || _myheight-_newheight < -0.35) then {
|
||||||
|
if (_EPOCH_Autorunspeed != 2) then {
|
||||||
|
player playActionnow 'PlayerSlowF';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
player playAction 'PlayerSlowF';
|
||||||
|
};
|
||||||
|
_EPOCH_Autorunspeed = 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (getFatigue player < 0.8) then {
|
||||||
|
if (_EPOCH_Autorunspeed != 3) then {
|
||||||
|
player playActionnow 'FastF';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
player playAction 'FastF';
|
||||||
|
};
|
||||||
|
_EPOCH_Autorunspeed = 3;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (_EPOCH_Autorunspeed != 2) then {
|
||||||
|
player playActionnow 'PlayerSlowF';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
player playAction 'PlayerSlowF';
|
||||||
|
};
|
||||||
|
_EPOCH_Autorunspeed = 2;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
44
Sources/epoch_code/compile/EPOCH_AutoRun_Check.sqf
Normal file
44
Sources/epoch_code/compile/EPOCH_AutoRun_Check.sqf
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
Author: He-Man
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
|
||||||
|
Description: Check, if Player can Autorun
|
||||||
|
|
||||||
|
Licence:
|
||||||
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
||||||
|
|
||||||
|
Github:
|
||||||
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_AutoRun_Check.sqf
|
||||||
|
|
||||||
|
Usage: call EPOCH_AutoRun_Check;
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
BOOL
|
||||||
|
*/
|
||||||
|
|
||||||
|
private["_canAutoRun","_currentPos"];
|
||||||
|
_canAutoRun = true;
|
||||||
|
if !(istouchingground player) exitwith {
|
||||||
|
false;
|
||||||
|
};
|
||||||
|
if !((vehicle player) == player) exitwith {
|
||||||
|
false;
|
||||||
|
};
|
||||||
|
if ((getPosasl player) select 2 < -0.5) exitwith {
|
||||||
|
false;
|
||||||
|
};
|
||||||
|
if ((player getHitPointDamage "HitLegs") >= 0.5) exitwith {
|
||||||
|
["Can not AutoRun - Your legs are Broken!",5] call Epoch_Message;
|
||||||
|
false;
|
||||||
|
};
|
||||||
|
if !(player nearObjects["Const_All_Walls_F", 6] isEqualTo[]) then {
|
||||||
|
_currentPos = player modelToWorld [0, 1, 1];
|
||||||
|
if !(surfaceIsWater _currentPos) then {
|
||||||
|
_currentPos = ATLtoASL _currentPos;
|
||||||
|
};
|
||||||
|
if (lineIntersects[eyePos player, _currentPos, player, objNull]) then {
|
||||||
|
_canAutoRun = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_canAutoRun
|
@ -242,7 +242,12 @@ if (vehicle player == player) then {
|
|||||||
// _handled = call EPOCH_lootTrash;
|
// _handled = call EPOCH_lootTrash;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
if (EPOCH_IsAutoRunning) then {
|
||||||
|
if (_dikCode in ((actionKeys "moveForward") + (actionKeys "TurnLeft") + (actionKeys "TurnRight") + (actionKeys "moveBack"))) then {
|
||||||
|
EPOCH_IsAutoRunning = false;
|
||||||
|
player switchMove "";
|
||||||
|
};
|
||||||
|
};
|
||||||
}; // end player only code
|
}; // end player only code
|
||||||
|
|
||||||
EPOCH_favBar_itemConsumed = false;
|
EPOCH_favBar_itemConsumed = false;
|
||||||
|
@ -47,5 +47,28 @@ if (_dikCode == EPOCH_keysAction) then {
|
|||||||
if (_dikCode in(actionKeys "Gear")) then {
|
if (_dikCode in(actionKeys "Gear")) then {
|
||||||
EPOCH_gearKeyPressed = false;
|
EPOCH_gearKeyPressed = false;
|
||||||
};
|
};
|
||||||
|
if (player == vehicle player) then {
|
||||||
|
if (_dikCode == EPOCH_keysAutoRun) then {
|
||||||
|
if (EPOCH_IsAutoRunning) then {
|
||||||
|
EPOCH_IsAutoRunning = false;
|
||||||
|
player switchMove "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (EPOCH_keysAutoRun in (actionKeys "moveForward")) then {
|
||||||
|
if (EPOCH_LastAutoRunKeyPressed + 0.2 > diag_ticktime) then {
|
||||||
|
if (call EPOCH_AutoRun_Check) then {
|
||||||
|
EPOCH_IsAutoRunning = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (call EPOCH_AutoRun_Check) then {
|
||||||
|
EPOCH_IsAutoRunning = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
EPOCH_LastAutoRunKeyPressed = diag_ticktime;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
_handled
|
_handled
|
||||||
|
@ -32,6 +32,7 @@ _keyMap =
|
|||||||
["Action","EPOCH_keysAction",0x39],
|
["Action","EPOCH_keysAction",0x39],
|
||||||
["Holster Weapon", "EPOCH_keysHolster", 35],
|
["Holster Weapon", "EPOCH_keysHolster", 35],
|
||||||
["Debug Monitor", "EPOCH_keysDebugMon", 41],
|
["Debug Monitor", "EPOCH_keysDebugMon", 41],
|
||||||
|
["AutoRun", "EPOCH_keysAutoRun", 0x11],
|
||||||
|
|
||||||
["Volume + (ctrl)","EPOCH_keysVolumeUp",0x0D],
|
["Volume + (ctrl)","EPOCH_keysVolumeUp",0x0D],
|
||||||
["Volume - (ctrl)","EPOCH_keysVolumeDown",0x0C],
|
["Volume - (ctrl)","EPOCH_keysVolumeDown",0x0C],
|
||||||
|
12
Sources/epoch_code/compile/setup/masterLoop/Event0.sqf
Normal file
12
Sources/epoch_code/compile/setup/masterLoop/Event0.sqf
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// runs every 0.4 seconds
|
||||||
|
|
||||||
|
if (EPOCH_IsAutoRunning) then {
|
||||||
|
if (call EPOCH_AutoRun_Check) then {
|
||||||
|
call EPOCH_AutoRun
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
EPOCH_IsAutoRunning = false;
|
||||||
|
player switchMove "";
|
||||||
|
["Autorun stopped",5] call Epoch_Message;
|
||||||
|
};
|
||||||
|
};
|
@ -111,7 +111,7 @@ _isOnFoot = isNull objectParent player;
|
|||||||
_panic = false;
|
_panic = false;
|
||||||
_prevEnergy = missionNamespace getVariable [_playerEnergyKey, _playerEnergyDefault];
|
_prevEnergy = missionNamespace getVariable [_playerEnergyKey, _playerEnergyDefault];
|
||||||
|
|
||||||
|
_EPOCH_Autorunspeed = 1;
|
||||||
// init config data
|
// init config data
|
||||||
_antagonistRndChance = ["CfgEpochClient", "antagonistRngChance", 100] call EPOCH_fnc_returnConfigEntryV2;
|
_antagonistRndChance = ["CfgEpochClient", "antagonistRngChance", 100] call EPOCH_fnc_returnConfigEntryV2;
|
||||||
|
|
||||||
|
@ -57,6 +57,8 @@ EPOCH_arr_interactedObjs = [];
|
|||||||
EPOCH_buildOption = 0;
|
EPOCH_buildOption = 0;
|
||||||
EPOCH_nearestLocations = [];
|
EPOCH_nearestLocations = [];
|
||||||
EPOCH_lastFiredLocation = [];
|
EPOCH_lastFiredLocation = [];
|
||||||
|
EPOCH_IsAutoRunning = false;
|
||||||
|
EPOCH_LastAutoRunKeyPressed = diag_ticktime;
|
||||||
|
|
||||||
//Radiation
|
//Radiation
|
||||||
EPOCH_geiger_shown = false;
|
EPOCH_geiger_shown = false;
|
||||||
|
@ -49,6 +49,8 @@ class CfgClientFunctions
|
|||||||
class makeMarker {};
|
class makeMarker {};
|
||||||
class removeMarker {};
|
class removeMarker {};
|
||||||
class unit_onKilledEH {};
|
class unit_onKilledEH {};
|
||||||
|
class AutoRun_Check {};
|
||||||
|
class AutoRun {};
|
||||||
};
|
};
|
||||||
class building
|
class building
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,10 @@ class CfgMasterLoop
|
|||||||
{
|
{
|
||||||
condition = "alive player";
|
condition = "alive player";
|
||||||
file = "epoch_code\compile\setup\masterLoop";
|
file = "epoch_code\compile\setup\masterLoop";
|
||||||
|
class Event0
|
||||||
|
{
|
||||||
|
delay = 0.4;
|
||||||
|
};
|
||||||
class Event1
|
class Event1
|
||||||
{
|
{
|
||||||
delay = 1;
|
delay = 1;
|
||||||
|
@ -22,6 +22,13 @@ All changes for [Arma 3](https://arma3.com/) [Epoch Mod](https://epochmod.com) a
|
|||||||
- Reduce rads over time at cost of immunity @Raymix
|
- Reduce rads over time at cost of immunity @Raymix
|
||||||
- Wearable Male & Female wearable full radiation suit @Helion4
|
- Wearable Male & Female wearable full radiation suit @Helion4
|
||||||
- December seasonal items (Santa / Snowman) @Helion4
|
- December seasonal items (Santa / Snowman) @Helion4
|
||||||
|
- Autorun function (suggested by Ghostrider) @He-Man
|
||||||
|
- Default Key is "W"
|
||||||
|
- You can change the key in EPOCH ESC Menu
|
||||||
|
- If choosen key is same as "moveforward" (default), you have to 2x tap it, else you only have to 1x tap it
|
||||||
|
- If your legs are broken, you get a hint "can not autorun - legs are broken"
|
||||||
|
- If the terrain is too steep, you only walk in AutoRun
|
||||||
|
- Inside Water, you can not Autorun
|
||||||
### Fixed
|
### Fixed
|
||||||
- False BE kicks since Arma 3 1.80 update.
|
- False BE kicks since Arma 3 1.80 update.
|
||||||
- Nightlight now also follow players inside Vehicles @He-Man
|
- Nightlight now also follow players inside Vehicles @He-Man
|
||||||
|
Loading…
Reference in New Issue
Block a user