mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-15 13:26:39 +03:00
Add Bike/Motorcycles brake fix
Made by @Victor-the-Cleaner
This commit is contained in:
27
SQF/dayz_code/compile/fnc_brakeFix.sqf
Normal file
27
SQF/dayz_code/compile/fnc_brakeFix.sqf
Normal file
@@ -0,0 +1,27 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Improve braking power of motorcycles and bicycles.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
local _bike = _this select 0;
|
||||
local _speed = speed _bike;
|
||||
local _slow = 0.4; // increase/decrease this value to adjust braking power. Must be > 0. Default: 0.4
|
||||
|
||||
while {player != (vehicle player)} do {
|
||||
if (DZE_isBraking && {_speed > 0}) then {
|
||||
local _vel = velocity _bike;
|
||||
local _dir = getDir _bike;
|
||||
|
||||
_bike setVelocity [
|
||||
(_vel select 0) - (sin _dir * _slow),
|
||||
(_vel select 1) - (cos _dir * _slow),
|
||||
(_vel select 2)
|
||||
];
|
||||
|
||||
DZE_isBraking = false;
|
||||
};
|
||||
uiSleep 0.01;
|
||||
_speed = speed _bike;
|
||||
};
|
||||
DZE_isOnBike = false;
|
||||
@@ -290,6 +290,11 @@ if (isNil "keyboard_keys") then {
|
||||
} forEach (_this select 0);
|
||||
};
|
||||
|
||||
local _brake = {
|
||||
if (DZE_isOnBike) then {DZE_isBraking = true};
|
||||
call _interrupt;
|
||||
};
|
||||
|
||||
keyboard_keys = [];
|
||||
channel_keys = [];
|
||||
voice_keys = [];
|
||||
@@ -331,7 +336,7 @@ if (isNil "keyboard_keys") then {
|
||||
[actionKeys "MoveLeft", _interrupt] call _addArray; // Delete Key
|
||||
[actionKeys "MoveRight", _interrupt] call _addArray; // End Key
|
||||
[actionKeys "MoveForward", _interrupt] call _addArray; // W / Up Arrow Keys
|
||||
[actionKeys "MoveBack", _interrupt] call _addArray; // S / Down Arrow Keys
|
||||
[actionKeys "MoveBack", _brake] call _addArray; // S / Down Arrow Keys
|
||||
[actionKeys "TurnLeft", _interrupt] call _addArray; // A / Left Arrow Keys
|
||||
[actionKeys "TurnRight", _interrupt] call _addArray; // D / Right Arrow Keys
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user