mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +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);
|
} forEach (_this select 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
local _brake = {
|
||||||
|
if (DZE_isOnBike) then {DZE_isBraking = true};
|
||||||
|
call _interrupt;
|
||||||
|
};
|
||||||
|
|
||||||
keyboard_keys = [];
|
keyboard_keys = [];
|
||||||
channel_keys = [];
|
channel_keys = [];
|
||||||
voice_keys = [];
|
voice_keys = [];
|
||||||
@@ -331,7 +336,7 @@ if (isNil "keyboard_keys") then {
|
|||||||
[actionKeys "MoveLeft", _interrupt] call _addArray; // Delete Key
|
[actionKeys "MoveLeft", _interrupt] call _addArray; // Delete Key
|
||||||
[actionKeys "MoveRight", _interrupt] call _addArray; // End Key
|
[actionKeys "MoveRight", _interrupt] call _addArray; // End Key
|
||||||
[actionKeys "MoveForward", _interrupt] call _addArray; // W / Up Arrow Keys
|
[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 "TurnLeft", _interrupt] call _addArray; // A / Left Arrow Keys
|
||||||
[actionKeys "TurnRight", _interrupt] call _addArray; // D / Right Arrow Keys
|
[actionKeys "TurnRight", _interrupt] call _addArray; // D / Right Arrow Keys
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ if (!isDedicated) then {
|
|||||||
fnc_remoteMessage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_remoteMessage.sqf";
|
fnc_remoteMessage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_remoteMessage.sqf";
|
||||||
fnc_freeBackpackSlots = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_freeBackpackSlots.sqf";
|
fnc_freeBackpackSlots = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_freeBackpackSlots.sqf";
|
||||||
fnc_apsiState = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\apsiState.sqf"; // Toggle APSI on and off
|
fnc_apsiState = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\apsiState.sqf"; // Toggle APSI on and off
|
||||||
|
fnc_brakeFix = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fnc_brakeFix.sqf"; // fix for motorcycle & bicycle brakes
|
||||||
if (DZE_EVR) then {call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\client_evr.sqf";};
|
if (DZE_EVR) then {call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\client_evr.sqf";};
|
||||||
|
|
||||||
if (DZE_Remote_Vehicle) then {
|
if (DZE_Remote_Vehicle) then {
|
||||||
@@ -256,6 +257,7 @@ if (!isDedicated) then {
|
|||||||
};
|
};
|
||||||
fnc_setWeather = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\weather\setWeather.sqf";
|
fnc_setWeather = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\weather\setWeather.sqf";
|
||||||
fnc_groundFog = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\weather\groundFog.sqf";
|
fnc_groundFog = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\weather\groundFog.sqf";
|
||||||
|
fnc_issheltered = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isSheltered.sqf";
|
||||||
|
|
||||||
// Compiles of all trading related functions
|
// Compiles of all trading related functions
|
||||||
call compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\AdvancedTrading\compiles.sqf";
|
call compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\AdvancedTrading\compiles.sqf";
|
||||||
|
|||||||
@@ -510,4 +510,6 @@ if (!isDedicated) then {
|
|||||||
DZE_sheltered = 0.0; // used in determining how much a player is sheltered from the environment
|
DZE_sheltered = 0.0; // used in determining how much a player is sheltered from the environment
|
||||||
DZE_roofOverhead = false;
|
DZE_roofOverhead = false;
|
||||||
DZE_allTrees = dayz_trees + ["b_craet1.p3d"]; // include shrubs that the player can hide in
|
DZE_allTrees = dayz_trees + ["b_craet1.p3d"]; // include shrubs that the player can hide in
|
||||||
|
DZE_isOnBike = false;
|
||||||
|
DZE_isBraking = false;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -309,8 +309,11 @@ while {1 == 1} do {
|
|||||||
//sleep 1;
|
//sleep 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Crowbar ammo fix
|
// Brake Fix for Motorcycles and Bicycles
|
||||||
//"MeleeCrowbar" call dayz_meleeMagazineCheck;
|
if (!DZE_isOnBike && {_refObj isKindOf "Motorcycle" && {driver _refObj == player}}) then { // player just mounted a motorcycle or bicycle
|
||||||
|
DZE_isOnBike = true;
|
||||||
|
[_refObj] spawn fnc_brakeFix;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
_stop = diag_tickTime;
|
_stop = diag_tickTime;
|
||||||
|
|||||||
Reference in New Issue
Block a user