mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Updated parameterization in Vehicle module.
This commit is contained in:
parent
275b0c4300
commit
84be21c64e
@ -1,10 +1,24 @@
|
|||||||
// by commy2
|
/*
|
||||||
|
* Author: commy2
|
||||||
|
* Toggle speed limiter for Driver in Vehicle.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Driver <OBJECT>
|
||||||
|
* 1: Vehicle <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [player, car] call ace_vehicles_fnc_speedLimiter
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_driver", "_vehicle"];
|
private "_maxSpeed";
|
||||||
|
|
||||||
_driver = _this select 0;
|
params ["_driver", "_vehicle"];
|
||||||
_vehicle = _this select 1;
|
|
||||||
|
|
||||||
if (GETGVAR(isSpeedLimiter,false)) exitWith {
|
if (GETGVAR(isSpeedLimiter,false)) exitWith {
|
||||||
[localize LSTRING(Off)] call EFUNC(common,displayTextStructured);
|
[localize LSTRING(Off)] call EFUNC(common,displayTextStructured);
|
||||||
@ -16,19 +30,15 @@ if (GETGVAR(isSpeedLimiter,false)) exitWith {
|
|||||||
playSound "ACE_Sound_Click";
|
playSound "ACE_Sound_Click";
|
||||||
GVAR(isSpeedLimiter) = true;
|
GVAR(isSpeedLimiter) = true;
|
||||||
|
|
||||||
private "_maxSpeed";
|
|
||||||
_maxSpeed = speed _vehicle max 10;
|
_maxSpeed = speed _vehicle max 10;
|
||||||
|
|
||||||
[{
|
[{
|
||||||
private ["_driver", "_vehicle", "_maxSpeed"];
|
params ["_args", "_idPFH"];
|
||||||
|
_args params ["_driver", "_vehicle", "_maxSpeed"];
|
||||||
_driver = _this select 0 select 0;
|
|
||||||
_vehicle = _this select 0 select 1;
|
|
||||||
_maxSpeed = _this select 0 select 2;
|
|
||||||
|
|
||||||
if (!GVAR(isSpeedLimiter) || {_driver != driver _vehicle}) exitWith {
|
if (!GVAR(isSpeedLimiter) || {_driver != driver _vehicle}) exitWith {
|
||||||
GVAR(isSpeedLimiter) = false;
|
GVAR(isSpeedLimiter) = false;
|
||||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
private "_speed";
|
private "_speed";
|
||||||
|
@ -1,23 +1,30 @@
|
|||||||
// by commy2
|
/*
|
||||||
|
* Author: commy2
|
||||||
|
* Delays engine engine start of vehicle.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Vehicle <OBJECT>
|
||||||
|
* 1: Is Engine on <BOOL>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [vehicle player, false] call ace_vehicle_fnc_startEngine
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_vehicle", "_isEngineOn"];
|
params ["_vehicle", "_isEngineOn"];
|
||||||
|
|
||||||
_vehicle = _this select 0;
|
|
||||||
_isEngineOn = _this select 1;
|
|
||||||
|
|
||||||
if (!_isEngineOn || {floor abs speed _vehicle > 0}) exitWith {};
|
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;
|
if (ACE_time > _time) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; };
|
||||||
_time = _this select 0 select 1;
|
|
||||||
_direction = _this select 0 select 2;
|
|
||||||
|
|
||||||
if (ACE_time > _time) exitWith {
|
|
||||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
|
||||||
};
|
|
||||||
|
|
||||||
_vehicle setVelocity [0, 0, 0];
|
_vehicle setVelocity [0, 0, 0];
|
||||||
_vehicle setVectorDirAndUp _direction;
|
_vehicle setVectorDirAndUp _direction;
|
||||||
|
Loading…
Reference in New Issue
Block a user