From 84be21c64e856d8522f1178346724934e2eccf19 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Tue, 4 Aug 2015 04:49:56 +0200 Subject: [PATCH] Updated parameterization in Vehicle module. --- .../vehicles/functions/fnc_speedLimiter.sqf | 32 +++++++++++------- addons/vehicles/functions/fnc_startEngine.sqf | 33 +++++++++++-------- 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/addons/vehicles/functions/fnc_speedLimiter.sqf b/addons/vehicles/functions/fnc_speedLimiter.sqf index 7ddb07433a..151c02fd8a 100644 --- a/addons/vehicles/functions/fnc_speedLimiter.sqf +++ b/addons/vehicles/functions/fnc_speedLimiter.sqf @@ -1,10 +1,24 @@ -// by commy2 +/* + * Author: commy2 + * Toggle speed limiter for Driver in Vehicle. + * + * Arguments: + * 0: Driver + * 1: Vehicle + * + * Return Value: + * None + * + * Example: + * [player, car] call ace_vehicles_fnc_speedLimiter + * + * Public: No + */ #include "script_component.hpp" -private ["_driver", "_vehicle"]; +private "_maxSpeed"; -_driver = _this select 0; -_vehicle = _this select 1; +params ["_driver", "_vehicle"]; if (GETGVAR(isSpeedLimiter,false)) exitWith { [localize LSTRING(Off)] call EFUNC(common,displayTextStructured); @@ -16,19 +30,15 @@ if (GETGVAR(isSpeedLimiter,false)) exitWith { playSound "ACE_Sound_Click"; GVAR(isSpeedLimiter) = true; -private "_maxSpeed"; _maxSpeed = speed _vehicle max 10; [{ - private ["_driver", "_vehicle", "_maxSpeed"]; - - _driver = _this select 0 select 0; - _vehicle = _this select 0 select 1; - _maxSpeed = _this select 0 select 2; + params ["_args", "_idPFH"]; + _args params ["_driver", "_vehicle", "_maxSpeed"]; if (!GVAR(isSpeedLimiter) || {_driver != driver _vehicle}) exitWith { GVAR(isSpeedLimiter) = false; - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; private "_speed"; diff --git a/addons/vehicles/functions/fnc_startEngine.sqf b/addons/vehicles/functions/fnc_startEngine.sqf index 63afd78e2e..dd00b43ad6 100644 --- a/addons/vehicles/functions/fnc_startEngine.sqf +++ b/addons/vehicles/functions/fnc_startEngine.sqf @@ -1,23 +1,30 @@ -// by commy2 +/* + * Author: commy2 + * Delays engine engine start of vehicle. + * + * Arguments: + * 0: Vehicle + * 1: Is Engine on + * + * Return Value: + * None + * + * Example: + * [vehicle player, false] call ace_vehicle_fnc_startEngine + * + * Public: No + */ #include "script_component.hpp" -private ["_vehicle", "_isEngineOn"]; - -_vehicle = _this select 0; -_isEngineOn = _this select 1; +params ["_vehicle", "_isEngineOn"]; if (!_isEngineOn || {floor abs speed _vehicle > 0}) exitWith {}; [{ - private ["_vehicle", "_time", "_direction"]; + params ["_args", "_idPFH"]; + _args params ["_vehicle", "_time", "_direction"]; - _vehicle = _this select 0 select 0; - _time = _this select 0 select 1; - _direction = _this select 0 select 2; - - if (ACE_time > _time) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; - }; + if (ACE_time > _time) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; _vehicle setVelocity [0, 0, 0]; _vehicle setVectorDirAndUp _direction;