Headers, Formating, Fixes, Lock Inventory Option

This commit is contained in:
PabstMirror 2015-03-15 11:27:21 -05:00
parent 85f2f5a467
commit 726bf8d407
16 changed files with 433 additions and 408 deletions

View File

@ -3,3 +3,15 @@ class Extended_PreInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_InventoryOpened_EventHandlers {
class CAManBase {
class ADDON {
clientInventoryOpened = QUOTE(_this call FUNC(onOpenInventory););
};
};
};

View File

@ -2,8 +2,9 @@ class CfgMagazines {
class CA_Magazine;
class ACE_key_customKeyMagazine: CA_Magazine {
picture = QUOTE(PATHTOF(ui\keyBlack.paa));
displayName = "ACE Vehicle Key"; //!!!CANNONT be localized!!!, because it is used as part of the magazineDetail string
displayName = "ACE Vehicle Key"; //!!!CANNOT be localized!!!: because it is used as part of the magazineDetail string
descriptionShort = "$STR_ACE_Vehicle_Item_Custom_Description";
count = 1;
mass = 0;
};
};

View File

@ -4,7 +4,7 @@
displayName = "$STR_ACE_Vehicle_Action_UnLock"; \
distance = 4; \
condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(2,3)]}); \
statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \
statement = QUOTE([ARR_3('VehicleLock_SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \
showDisabled = 0; \
priority = 0.3; \
icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \
@ -13,7 +13,7 @@
displayName = "$STR_ACE_Vehicle_Action_Lock"; \
distance = 4; \
condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(0,1)]}); \
statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \
statement = QUOTE([ARR_3('VehicleLock_SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \
showDisabled = 0; \
priority = 0.2; \
icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \
@ -49,19 +49,24 @@ class CfgVehicles {
class Logic;
class Module_F: Logic {
class ArgumentsBaseUnits {};
class ModuleDescription {};
};
class ACE_VehicleLock_ModuleSetup: Module_F {
author = "$STR_ACE_Common_ACETeam";
category = "ACE";
displayName = "Vehicle Lock Setup";
function = "ACE_VehicleLock_fnc_moduleInit";
function = QUOTE(DFUNC(moduleInit));
scope = 2;
isGlobal = 1;
isGlobal = 0;
icon = QUOTE(PATHTOF(ui\IconLock_ca.paa));
functionPriority = 0;
class Arguments {
class LockVehicleInventory {
displayName = "Lock Vehicle Inventory";
description = "Locks the inventory of locked vehicles";
typeName = "BOOL";
defaultValue = 0;
};
class SetLockState {
displayName = "Set Lock State"; // Argument label
description = "Set lock state for all vehicles on map at start"; // Tooltip description
@ -72,9 +77,9 @@ class CfgVehicles {
class Unique {name = "Unlocked"; value = 2;};
};
};
class LockpickStrength {
displayName = "Global Lockpick Strength";
description = "Global Time to lockpick (in seconds). Default: 10";
class DefaultLockpickStrength {
displayName = "Default Lockpick Strength";
description = "Default Time to lockpick (in seconds). Default: 10";
typeName = "NUMBER"; // Value type, can be "NUMBER", "STRING" or "BOOL"
defaultValue = "10"; // Default text filled in the input box
};
@ -88,9 +93,9 @@ class CfgVehicles {
author = "$STR_ACE_Common_ACETeam";
category = "ACE";
displayName = "Vehicle Key Assign";
function = "ACE_VehicleLock_fnc_moduleSync";
function = QUOTE(DFUNC(moduleSync));
scope = 2;
isGlobal = 1;
isGlobal = 0;
icon = QUOTE(PATHTOF(ui\IconLock_ca.paa));
functionPriority = 0;
class Arguments {};

View File

@ -10,7 +10,7 @@ class CfgWeapons {
picture = QUOTE(PATHTOF(ui\keyBlack.paa));
scope = 2;
class ItemInfo: InventoryItem_Base_F {
mass = 0.1;
mass = 0;
};
};
class ACE_key_lockpick: ACE_key_master {

View File

@ -0,0 +1,5 @@
#include "script_component.hpp"
//Add Event Handlers
["VehicleLock_SetupCustomKey", {_this call FUNC(serverSetupCustomKeyEH)}] call EFUNC(common,addEventHandler);
["VehicleLock_SetVehicleLock", {_this call FUNC(setVehicleLockEH)}] call EFUNC(common,addEventHandler);

View File

@ -8,11 +8,8 @@ PREP(hasKeyForVehicle);
PREP(lockpick);
PREP(moduleInit);
PREP(moduleSync);
PREP(onOpenInventory);
PREP(serverSetupCustomKeyEH);
PREP(setVehicleLockEH);
//Add Event Handlers
["SetupCustomKey", {_this call FUNC(serverSetupCustomKeyEH)}] call EFUNC(common,addEventHandler);
["SetVehicleLock", {_this call FUNC(setVehicleLockEH)}] call EFUNC(common,addEventHandler);
ADDON = true;

View File

@ -17,6 +17,10 @@ class ACE_Settings {
value = 10;
typeName = "SCALAR";
};
class GVAR(LockVehicleInventory) {
value = 0;
typeName = "BOOL";
};
};
#include "CfgEventHandlers.hpp"

View File

@ -1,45 +1,40 @@
/*
Name: ACE_VehicleLock_fnc_addKeyForVehicle
Author: Pabst Mirror
Description:
Adds a key to a unit that will open a vehicle
Parameters:
0: OBJECT - unit
1: OBJECT - vehicle
2: BOOL - custom key (true: custom key (magazine) - false: side key (item))
Returns:
Nothing
Example:
[bob, car1, true] call ACE_VehicleLock_fnc_addKeyForVehicle;
*/
* Author: PabstMirror
* Adds a key to a unit that will open a vehicle
* Note: has global effects for Unit (will add items to remote unit)
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Vehicle <OBJECT>
* 2: custom key (true: custom key (magazine) - false: side key (item)) <BOOL>
*
* Return Value:
* None
*
* Example:
* [ACE_player, car, true] call ACE_VehicleLock_fnc_addKeyForVehicle
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit","_veh","_useCustom","_previousMags","_newMags","_keyMagazine","_keyName"];
private ["_previousMags","_newMags","_keyMagazine","_keyName"];
_unit = [_this, 0, objNull, [objNull]] call bis_fnc_param;
_veh = [_this, 1, objNull, [objNull]] call bis_fnc_param;
_useCustom = [_this, 2, false, [false]] call bis_fnc_param;
PARAMS_3(_unit,_veh,_useCustom);
if (isNull _unit) exitWith {["addKeyForVehicleClient: null unit"] call BIS_fnc_error;};
if (isNull _veh) exitWith {["addKeyForVehicleClient: null vehicle"] call BIS_fnc_error;};
if (isNull _unit) exitWith {ERROR("null unit");};
if (isNull _veh) exitWith {ERROR("null vehicle");};
if (_useCustom) then {
_previousMags = magazinesDetail _unit;
_unit addMagazine ["ACE_key_customKeyMagazine", 1];
_unit addMagazine ["ACE_key_customKeyMagazine", 1]; //addMagazine array has global effects
_newMags = (magazinesDetail _unit) - _previousMags;
if ((count _newMags) == 0) exitWith {
["ACE_VehicleLock_fnc_addKeyForVehicle: failed to add magazine (inventory full?)"] call BIS_fnc_error;
};
if ((count _newMags) == 0) exitWith {ERROR("failed to add magazine (inventory full?)");};
_keyMagazine = _newMags select 0;
TRACE_2("setting up key on server",_veh,_keyMagazine);
["SetupCustomKey", [_veh, _keyMagazine]] call EFUNC(common,serverEvent);
//Have the server run add the key to the vehicle's key array:
["VehicleLock_SetupCustomKey", [_veh, _keyMagazine]] call EFUNC(common,serverEvent);
} else {
_keyName = [_veh] call FUNC(getVehicleSideKey);
_unit addItem _keyName;
_unit addItem _keyName; //addItem has global effects
};

View File

@ -1,27 +1,25 @@
/*
Name: ACE_VehicleLock_fnc_getVehicleSideKey
Author: Pabst Mirror
Description:
Returns the side specifc key for a vehicle
Parameters:
0: OBJECT - vehicle
Returns:
STRING - Key Classname
Example:
[tank1] call ACE_VehicleLock_fnc_getVehicleSideKey;
*/
* Author: PabstMirror
* Returns the side specifc key for a vehicle
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* The vehicle's side key classname <STRING>
*
* Example:
* [tank1] call ACE_VehicleLock_fnc_getVehicleSideKey;
*
* Public: No
*/
#include "script_component.hpp"
private ["_veh","_vehConfigSide","_vehSide","_returnValue"];
private ["_vehConfigSide","_vehSide","_returnValue"];
_veh = [_this, 0, objNull, [objNull]] call bis_fnc_param;
if (isNull _veh) exitWith {["ACE_VehicleLock_fnc_getVehicleSideKey: null vehicle"] call BIS_fnc_error; ""};
PARAMS_1(_veh);
if (isNull _veh) exitWith {ERROR("null vehicle"); "error"};
_vehConfigSide = [_veh, true] call BIS_fnc_objectSide;
_vehSide = _veh getVariable [QGVAR(lockSide), _vehConfigSide];
@ -32,7 +30,7 @@ switch (_vehSide) do {
case (west): {_returnValue = "ACE_key_west"};
case (east): {_returnValue = "ACE_key_east"};
case (resistance): {_returnValue = "ACE_key_indp"};
case (civilian): {_returnValue = "ACE_key_civ"};
default {_returnValue = "ACE_key_civ"};
};
_returnValue

View File

@ -1,31 +1,27 @@
/*
Name: ACE_VehicleLock_fnc_hasKeyForVehicle
Author: Pabst Mirror
Description:
Returns if user has a valid key for the vehicle
Parameters:
0: OBJECT - unit
1: OBJECT - vehicle
Returns:
BOOL - unit has key for vehicle
Example:
[bob, car] call ACE_VehicleLock_fnc_hasKeyForVehicle;
*/
* 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
*/
#include "script_component.hpp"
private ["_unit","_veh","_returnValue","_sideKeyName","_customKeys"];
private ["_returnValue","_sideKeyName","_customKeys"];
_unit = [_this, 0, objNull, [objNull]] call bis_fnc_param;
_veh = [_this, 1, objNull, [objNull]] call bis_fnc_param;
PARAMS_2(_unit,_veh);
if (isNull _unit) exitWith {["ACE_VehicleLock_fnc_hasKeyForVehicle: null unit"] call BIS_fnc_error; false};
if (isNull _veh) exitWith {["ACE_VehicleLock_fnc_hasKeyForVehicle: null vehicle"] call BIS_fnc_error; false};
if (isNull _unit) exitWith {ERROR("null unit"); false};
if (isNull _veh) exitWith {ERROR("null vehicle"); false};
_returnValue = false;

View File

@ -1,79 +1,66 @@
/*
Name: ACE_VehicleLock_fnc_lockpick
Author: Pabst Mirror
Description:
Handles lockpick functionality from action menu.
Parameters:
0: OBJECT - unit
1: OBJECT - vehicle
2: STRING - function type
"canLockpick": returns BOOL if lockpick is possible
"startLockpick": starts the process
"finishLockpick": on completions, opens the lock
Returns:
BOOL
Example:
[ACE_player, ACE_Interaction_Target, 'canLockpick'] call ACE_VehicleLock_fnc_lockpick
*/
* Author: PabstMirror
* Handles lockpick functionality. Three different functions:
* "canLockpick": returns BOOL if lockpick is possible
* "startLockpick": starts the process
* "finishLockpick": on completions, opens the lock
*
* Arguments:
* 0: Unit (player) <OBJECT>
* 1: Vehicle <OBJECT>
* 2: Function Type <OBJECT>
*
* Return Value:
* "canLockpick" <BOOL>
*
* Example:
* [ACE_player, ACE_Interaction_Target, 'canLockpick'] call ACE_VehicleLock_fnc_lockpick
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit","_veh","_funcType","_vehLockpickStrenth","_returnValue", "_condition"];
private ["_vehLockpickStrenth","_condition","_returnValue"];
_unit = [_this, 0, objNull, [objNull]] call bis_fnc_param;
_veh = [_this, 1, objNull, [objNull]] call bis_fnc_param;
_funcType = [_this, 2, "", [""]] call bis_fnc_param;
PARAMS_3(_unit,_veh,_funcType);
if (isNull _unit) exitWith {
["ACE_VehicleLock_fnc_lockpick: null unit"] call BIS_fnc_error;
false
};
if (isNull _veh) exitWith {
["ACE_VehicleLock_fnc_lockpick: null vehicle"] call BIS_fnc_error;
false
};
if (isNull _unit) exitWith {ERROR("null unit"); false};
if (isNull _veh) exitWith {ERROR("null vehicle"); false};
//need lockpick item
if (!("ACE_key_lockpick" in (items _unit))) exitWith {
false
};
if (!("ACE_key_lockpick" in (items _unit))) exitWith {false};
_vehLockpickStrenth = _veh getVariable[QGVAR(lockpickStrength), GVAR(DefaultLockpickStrength)];
if (typeName _vehLockpickStrenth != "SCALAR") exitWith {
["ACE_VehicleLock_fnc_lockpick: 'ACE_vehicleLock_LockpickStrength' invalid: (%1)", _veh] call BIS_fnc_error;
false
};
if (typeName _vehLockpickStrenth != "SCALAR") exitWith {ERROR("ACE_vehicleLock_LockpickStrength invalid"); false};
//-1 indicates unpickable lock
if (_vehLockpickStrenth < 0) exitWith {
false
if (_vehLockpickStrenth < 0) exitWith {false};
//Condition check for progressBar
_condition = {
PARAMS_1(_args);
EXPLODE_2_PVT(_args,_unit,_veh);
((_unit distance _veh) < 5) && {(speed _veh) < 0.1}
};
_returnValue = false;
if (!([[_unit, _veh]] call _condition)) exitWith {false};
_returnValue = false;
switch (true) do {
case (_funcType == "canLockpick"): {
_returnValue = true;
};
case (_funcType == "startLockpick"): {
_condition = {
PARAMS_1(_args);
EXPLODE_2_PVT(_args,_unit,_veh);
([_unit, objNull, []] call EFUNC(common,canInteractWith)) && ((_unit distance _veh) < 5) && ((speed _veh) < 1)
};
[_vehLockpickStrenth, [_unit, _veh, "finishLockpick"], {(_this select 0) call FUNC(lockpick)}, {}, (localize "STR_ACE_Vehicle_Action_LockpickInUse"), _condition] call EFUNC(common,progressBar);
_returnValue = true;
};
case (_funcType == "finishLockpick"): {
["SetVehicleLock", [_veh], [_veh, false]] call EFUNC(common,targetEvent);
["VehicleLock_SetVehicleLock", [_veh], [_veh, false]] call EFUNC(common,targetEvent);
_returnValue = true;
};
default {
["ACE_VehicleLock_fnc_lockpick: bad function type"] call BIS_fnc_error;
ERROR("bad function type");
};
};
_returnValue;
_returnValue

View File

@ -1,22 +1,20 @@
/*
Name: ACE_VehicleLock_fnc_moduleInit
Author: Pabst Mirror
Description:
Function for setup module. Sets default lockpick strength, auto handout keys, and default lock state.
Parameters:
0: OBJECT - logic
1: ignored
2: BOOL - Module Activated
Returns:
Nothing
Example:
called from module
*/
* Author: PabstMirror
* Function for setup module. Sets default lockpick strength and default lock state.
*
* Arguments:
* 0: The Module Logic Object <OBJECT>
* 1: synced objects <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Example:
* [fromModule] call ACE_VehicleLock_fnc_hasKeyForVehicle;
*
* Public: No
*/
#include "script_component.hpp"
private ["_sideKeysAssignment", "_setLockState", "_lock"];
@ -24,18 +22,17 @@ private ["_sideKeysAssignment", "_setLockState", "_lock"];
PARAMS_3(_logic,_syncedUnits,_activated);
if (!_activated) exitWith {WARNING("Vehicle Lock Init Module - placed but not active");};
if (!isServer) exitWith {};
//Set the GVAR for default lockpick strength
[_logic, QGVAR(DefaultLockpickStrength), "DefaultLockpickStrength"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(LockVehicleInventory), "LockVehicleInventory"] call EFUNC(common,readSettingFromModule);
_sideKeysAssignment = _logic getVariable["SideKeysAssignment", 0];
_setLockState = _logic getVariable["SetLockState", 0];
if (isServer) then {
[_logic, QGVAR(DefaultLockpickStrength), "LockpickStrength"] call EFUNC(common,readSettingFromModule);
};
//Run at mission start (anyone besides JIPs)
if (isServer || {player == player}) then {
[{
PARAMS_1(_setLockState);
{
if ((local _x) && {(_x isKindOf "Car") || (_x isKindOf "Tank") || (_x isKindOf "Helicopter")}) then {
if ((_x isKindOf "Car") || {_x isKindOf "Tank"} || {_x isKindOf "Helicopter"}) then {
//set lock state (eliminates the ambigious 1-"Default" and 3-"Locked for Player" states)
_lock = switch (_setLockState) do {
case (0): {(locked _x) in [2, 3]};
@ -44,8 +41,9 @@ if (isServer || {player == player}) then {
};
if (((_lock) && {(locked _x) != 2}) || {(!_lock) && {(locked _x) != 0}}) then {
TRACE_3("Setting Lock State", _lock, (typeOf _x), _x);
["SetVehicleLock", [_x, _lock]] call EFUNC(common,localEvent);
["VehicleLock_SetVehicleLock", [_x], [_x, _lock]] call EFUNC(common,targetEvent);
};
};
} forEach vehicles;
};
//Delay call until mission start (so everyone has the eventHandler's installed)
}, [_setLockState], 0.25, 0.25] call EFUNC(common,waitAndExecute);

View File

@ -1,22 +1,20 @@
/*
Name: ACE_VehicleLock_fnc_moduleSync
Author: Pabst Mirror
Description:
Function for sync module. Assigns keys for all synced vehicles to any players that are synced.
Parameters:
0: OBJECT - logic
1: ARRAY - synced objects (only objects at mission start, so JIP without AI won't be present)
Returns:
Nothing
Example:
called from module
*/
* Author: PabstMirror
* Function for sync module. Assigns keys for all synced vehicles to any players that are synced.
*
* Arguments:
* 0: The Module Logic Object <OBJECT>
* 1: synced objects <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Example:
* [fromModule] call ACE_VehicleLock_fnc_moduleSync;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_logic,_syncedObjects,_activated);
@ -24,9 +22,9 @@ PARAMS_3(_logic,_syncedObjects,_activated);
if !(_activated) exitWith {WARNING("Vehicle Lock Sync Module - placed but not active");};
if (!isServer) exitWith {};
_addKeyAfterGearAssign = {
private ["_syncedObjects", "_listOfVehicles"];
_syncedObjects = _this select 0;
[{
private ["_listOfVehicles"];
PARAMS_1(_syncedObjects);
_listOfVehicles = [];
{
if ((_x isKindOf "Car") || (_x isKindOf "Tank") || (_x isKindOf "Helicopter")) then {
@ -34,7 +32,7 @@ _addKeyAfterGearAssign = {
};
} forEach _syncedObjects;
if ((count _listOfVehicles) == 0) exitWith { //Verbose error for mission makers
if ((count _listOfVehicles) == 0) exitWith { //Verbose error for mission makers (only shows on server)
["ACE_VehicleLock_fnc_moduleSync: no vehicles synced"] call BIS_fnc_error;
};
@ -46,7 +44,6 @@ _addKeyAfterGearAssign = {
} forEach _listOfVehicles;
};
} forEach _syncedObjects;
};
//Wait to add keys until various gear assigns have finished (~5 seconds)
[_addKeyAfterGearAssign, [_syncedObjects], 5, 1] call EFUNC(common,waitAndExecute);
//Wait to add keys until various gear assigns have finished (~5 seconds)
}, [_syncedObjects], 5, 1] call EFUNC(common,waitAndExecute);

View File

@ -0,0 +1,40 @@
/*
* Author: PabstMirror
* Handles the inventory opening.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Container <OBJECT>
*
* Return Value:
* Handeled <BOOL>
*
* Example:
* [player, car] call ACE_VehicleLock_fnc_onOpenInventory;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_container);
//Only check for player:
if (_unit != ace_player) exitWith {false};
_handeled = false;
if (GVAR(LockVehicleInventory) && //if setting not enabled
{(vehicle ace_player) == ace_player} && //Player dismounted
{(_container isKindOf "Car") || (_container isKindOf "Tank") || (_container isKindOf "Helicopter")} && //container is a lockable veh
{(locked _container) in [2,3]} && //Vehicle is locked
{!([ace_player, _container] call FUNC(hasKeyForVehicle))} //player doesn't have key
) then {
//Give feedback that vehicle is locked
playSound "ACE_Sound_Click";
//don't open the vehicles inventory
_handeled = true;
//Just opens a dummy groundContainer
ACE_player action ["Gear", objNull];
};
_handeled

View File

@ -1,22 +1,19 @@
/*
Name: ACE_VehicleLock_fnc_serverSetupCustomKeyEH
Author: Pabst Mirror
Description:
Adds a key (magazineDetail name) to approved keys for a vehicle
Parameters:
0: OBJECT - vehicle
1: STRING - Magazine Name
Returns:
Nothing
Example:
[tank1, "someMagainze [id xx:yy]"] call ACE_VehicleLock_fnc_serverSetupCustomKeyEH;
*/
/*
* Author: PabstMirror
* On the server: Adds a key (magazineDetail name) to approved keys for a vehicle.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Magazine Name <STRING>
*
* Return Value:
* None
*
* Example:
* [tank1, "someMagainze [id xx:yy]"] call ACE_VehicleLock_fnc_serverSetupCustomKeyEH
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_currentKeys"];
@ -24,6 +21,7 @@ private ["_currentKeys"];
PARAMS_2(_veh,_key);
if (!isServer) exitWith {ERROR("only run on server");};
if (isNull _veh) exitWith {ERROR("null vehicle");};
if (_key == "") exitWith {ERROR("empty key string");};
_currentKeys = _veh getVariable [QGVAR(customKeys), []];

View File

@ -1,33 +1,25 @@
/*
Name: ACE_VehicleLock_fnc_setVehicleLockEH
Author: Pabst Mirror
Description:
Sets a vehicle lock state because of a "SetVehicleLock" event
Parameters:
0: OBJECT - vehicle
1: BOOL - new lock state
Returns:
Nothing
Example:
[tank1, false] call ACE_VehicleLock_fnc_setVehicleLockEH;
*/
* Author: PabstMirror
* Sets a vehicle lock state because of a "VehicleLock_SetVehicleLock" event
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: New lock state <BOOL>
*
* Return Value:
* None
*
* Example:
* [tank1, false] call ACE_VehicleLock_fnc_setVehicleLockEH;
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_veh","_isLocked","_lockNumber"];
private ["_lockNumber"];
_veh = [_this, 0, objNull, [objNull]] call bis_fnc_param;
_isLocked = [_this, 1, false, [false]] call bis_fnc_param;
PARAMS_2(_veh,_isLocked);
_lockNumber = if (_isLocked) then {2} else {0};
TRACE_2("Setting Lock State", _veh, _lockNumber);
_veh lock _lockNumber;
// _veh setVariable ["ACE_LockedInventory", _isLocked, true]; //todo inventory lock