ACE3/addons/vehiclelock/functions/fnc_handleVehicleInitPost.sqf
commy2 001942b2ed Vehicle Lock - Enable for planes (#6646)
* enable vehicle lock module for planes

* Add actions to planes

* improved lazy eval

* remove superfluous parent class check

* IS_KIND_OF_ANY macro

* Update addons/vehiclelock/functions/fnc_moduleSync.sqf

* Improve handleVehicleInitPost XEH
2018-10-21 16:37:16 -05:00

34 lines
944 B
Plaintext

#include "script_component.hpp"
/*
* Author: PabstMirror
* For every lockable vehicle, sets the starting lock state to a sane value.
* Only run if the enabled via settings
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [car] call ACE_VehicleLock_fnc_handleVehicleInitPost
*
* Public: No
*/
params ["_vehicle"];
TRACE_1("handleVehicleInitPost",_vehicle);
if (alive _vehicle) then {
//set lock state (eliminates the ambigious 1-"Default" and 3-"Locked for Player" states)
private _lock = switch (GVAR(VehicleStartingLockState)) do {
case 0: {locked _vehicle in [2, 3]};
case 1: {true};
case 2: {false};
};
if ((_lock && {locked _vehicle != 2}) || {!_lock && {locked _vehicle != 0}}) then {
TRACE_3("Setting Lock State",_lock,typeOf _vehicle,_vehicle);
[QGVAR(SetVehicleLock), [_vehicle, _lock], [_vehicle]] call CBA_fnc_targetEvent;
};
};