2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-01-23 22:40:39 +00:00
|
|
|
/*
|
2015-03-15 16:27:21 +00:00
|
|
|
* Author: PabstMirror
|
|
|
|
* Returns if user has a valid key for the vehicle
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Vehicle <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* unit has key for vehicle <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [bob, car] call ACE_VehicleLock_fnc_hasKeyForVehicle;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-23 22:40:39 +00:00
|
|
|
|
2015-08-04 03:11:45 +00:00
|
|
|
params ["_unit", "_veh"];
|
2015-08-07 18:24:47 +00:00
|
|
|
TRACE_2("params",_unit,_veh);
|
2015-01-23 22:40:39 +00:00
|
|
|
|
2015-03-15 16:27:21 +00:00
|
|
|
if (isNull _unit) exitWith {ERROR("null unit"); false};
|
|
|
|
if (isNull _veh) exitWith {ERROR("null vehicle"); false};
|
2015-01-23 22:40:39 +00:00
|
|
|
|
|
|
|
//Master can open anything "no matter what"
|
2018-09-17 19:03:28 +00:00
|
|
|
private _items = _unit call EFUNC(common,uniqueItems);
|
2018-10-10 01:21:46 +00:00
|
|
|
if ("ACE_key_master" in _items) exitWith {true};
|
2015-01-23 22:40:39 +00:00
|
|
|
|
|
|
|
//Check side key
|
2017-10-10 14:39:59 +00:00
|
|
|
private _sideKeyName = [_veh] call FUNC(getVehicleSideKey);
|
2018-10-10 01:21:46 +00:00
|
|
|
if (_sideKeyName in _items) exitWith {true};
|
2015-01-23 22:40:39 +00:00
|
|
|
|
|
|
|
//Check custom keys
|
2017-10-10 14:39:59 +00:00
|
|
|
private _customKeys = _veh getVariable [QGVAR(customKeys), []];
|
2018-10-10 01:21:46 +00:00
|
|
|
private _magazines = magazinesDetail _unit;
|
2015-01-23 22:40:39 +00:00
|
|
|
|
2018-10-10 01:21:46 +00:00
|
|
|
(_customKeys findIf {_x in _magazines}) != -1
|