2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-08-04 02:49:56 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
2015-08-05 04:02:21 +00:00
|
|
|
* Delays engine start of vehicle.
|
2015-08-04 02:49:56 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Vehicle <OBJECT>
|
|
|
|
* 1: Is Engine on <BOOL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2020-04-25 06:41:45 +00:00
|
|
|
* [vehicle player, false] call ace_vehicles_fnc_startEngine
|
2015-08-04 02:49:56 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-16 13:20:41 +00:00
|
|
|
|
2015-08-04 02:49:56 +00:00
|
|
|
params ["_vehicle", "_isEngineOn"];
|
2015-01-16 13:20:41 +00:00
|
|
|
|
2018-10-06 11:41:26 +00:00
|
|
|
if (!_isEngineOn || {floor abs speed _vehicle > 0 || {!isNull isVehicleCargo _vehicle}}) exitWith {};
|
2015-01-16 13:20:41 +00:00
|
|
|
|
2021-07-27 17:47:07 +00:00
|
|
|
private _startupDelay = _vehicle getVariable [QGVAR(engineStartDelay), getNumber (configOf _vehicle >> QGVAR(engineStartDelay))];
|
|
|
|
if (_startupDelay <= 0) exitWith {};
|
|
|
|
|
2015-01-16 13:20:41 +00:00
|
|
|
[{
|
2015-08-04 02:49:56 +00:00
|
|
|
params ["_args", "_idPFH"];
|
|
|
|
_args params ["_vehicle", "_time", "_direction"];
|
2015-01-16 13:20:41 +00:00
|
|
|
|
2016-03-02 10:01:39 +00:00
|
|
|
if (CBA_missionTime > _time) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; };
|
2015-01-16 13:20:41 +00:00
|
|
|
|
|
|
|
_vehicle setVelocity [0, 0, 0];
|
|
|
|
_vehicle setVectorDirAndUp _direction;
|
|
|
|
|
2021-07-27 17:47:07 +00:00
|
|
|
} , 0, [_vehicle, CBA_missionTime + _startupDelay, [vectorDir _vehicle, vectorUp _vehicle]]] call CBA_fnc_addPerFrameHandler;
|