Epoch/Sources/epoch_code/compile/EPOCH_AutoRun_Check.sqf
He-Man 096f03e7b9 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
2018-01-18 21:40:18 +01:00

45 lines
1.0 KiB
Plaintext

/*
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