Add Bike/Motorcycles brake fix

Made by @Victor-the-Cleaner
This commit is contained in:
A Man
2022-05-18 18:20:29 +02:00
parent 0799e7e183
commit 2ebe0d6552
5 changed files with 42 additions and 3 deletions

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

View File

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