2015-04-28 05:08:28 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
2015-04-28 18:26:52 +00:00
|
|
|
* For every lockable vehicle, sets the starting lock state to a sane value.
|
|
|
|
* Only run if the InitModule is placed.
|
2015-04-28 05:08:28 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Vehicle <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [car] call ACE_VehicleLock_fnc_handleVehicleInitPost
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
if (!isServer) exitWith {};
|
|
|
|
|
2015-08-04 03:11:45 +00:00
|
|
|
params ["_vehicle"];
|
2015-08-07 18:24:47 +00:00
|
|
|
TRACE_1("params",_vehicle);
|
2015-08-04 03:11:45 +00:00
|
|
|
|
2015-04-28 05:08:28 +00:00
|
|
|
[{
|
2015-04-28 18:26:52 +00:00
|
|
|
//If the module wasn't placed, just exit (needs to be in wait because objectInitEH is before moduleInit)
|
|
|
|
if (GVAR(VehicleStartingLockState) == -1) exitWith {};
|
2015-08-04 03:11:45 +00:00
|
|
|
|
2015-04-28 05:08:28 +00:00
|
|
|
private ["_lock"];
|
2015-08-04 03:11:45 +00:00
|
|
|
|
|
|
|
params ["_vehicle"];
|
|
|
|
|
2015-04-28 05:08:28 +00:00
|
|
|
if ((_vehicle isKindOf "Car") || {_vehicle isKindOf "Tank"} || {_vehicle isKindOf "Helicopter"}) then {
|
|
|
|
//set lock state (eliminates the ambigious 1-"Default" and 3-"Locked for Player" states)
|
|
|
|
_lock = switch (GVAR(VehicleStartingLockState)) do {
|
2015-08-04 03:11:45 +00:00
|
|
|
case (0): { (locked _vehicle) in [2, 3] };
|
|
|
|
case (1): { true };
|
|
|
|
case (2): { false };
|
2015-04-28 05:08:28 +00:00
|
|
|
};
|
2015-08-04 03:11:45 +00:00
|
|
|
if ((_lock && {(locked _vehicle) != 2}) || {!_lock && {(locked _vehicle) != 0}}) then {
|
2015-04-28 05:08:28 +00:00
|
|
|
TRACE_3("Setting Lock State",_lock,(typeOf _vehicle),_vehicle);
|
2016-05-25 00:37:24 +00:00
|
|
|
[QGVAR(SetVehicleLock), [_vehicle, _lock], [_vehicle]] call CBA_fnc_targetEvent;
|
2015-04-28 05:08:28 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
//Delay call until mission start (so everyone has the eventHandler's installed)
|
2016-05-22 13:27:24 +00:00
|
|
|
}, [_vehicle], 0.25] call CBA_fnc_waitAndExecute;
|