mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
fa6da1ae7c
* Add configurable engine startup delay * add suggested change Add space char Co-authored-by: Dystopian <sddex@ya.ru> * Squashed commit of the following: commit 14f5483d8fa49d36effa8b18a3df392ed39b19da Author: Serg Vergun <1197314+severgun@users.noreply.github.com> Date: Fri Jul 23 20:23:52 2021 +0300 Add 0 cap and update docs commit e3ce7f273882b3f4e2cba916c39b506f857b20db Author: severgun <sewergun@gmail.com> Date: Fri Jul 23 12:42:42 2021 +0300 add parentheses commit b36eedc61b5e6bb868c37901bd4191767fbdaff8 Author: severgun <sewergun@gmail.com> Date: Fri Jul 23 12:34:30 2021 +0300 Add ability to set engine startup delay per vehicle by script * Change function name * add suggested exitWith condition Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Update docs/wiki/framework/vehicles-framework.md Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: Dystopian <sddex@ya.ru> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
36 lines
977 B
Plaintext
36 lines
977 B
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: commy2
|
|
* Delays engine start of vehicle.
|
|
*
|
|
* Arguments:
|
|
* 0: Vehicle <OBJECT>
|
|
* 1: Is Engine on <BOOL>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [vehicle player, false] call ace_vehicles_fnc_startEngine
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_vehicle", "_isEngineOn"];
|
|
|
|
if (!_isEngineOn || {floor abs speed _vehicle > 0 || {!isNull isVehicleCargo _vehicle}}) exitWith {};
|
|
|
|
private _startupDelay = _vehicle getVariable [QGVAR(engineStartDelay), getNumber (configOf _vehicle >> QGVAR(engineStartDelay))];
|
|
if (_startupDelay <= 0) exitWith {};
|
|
|
|
[{
|
|
params ["_args", "_idPFH"];
|
|
_args params ["_vehicle", "_time", "_direction"];
|
|
|
|
if (CBA_missionTime > _time) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; };
|
|
|
|
_vehicle setVelocity [0, 0, 0];
|
|
_vehicle setVectorDirAndUp _direction;
|
|
|
|
} , 0, [_vehicle, CBA_missionTime + _startupDelay, [vectorDir _vehicle, vectorUp _vehicle]]] call CBA_fnc_addPerFrameHandler;
|