diff --git a/addons/vehiclelock/CfgEventHandlers.hpp b/addons/vehiclelock/CfgEventHandlers.hpp
index b928bc2de6..cf704d000c 100644
--- a/addons/vehiclelock/CfgEventHandlers.hpp
+++ b/addons/vehiclelock/CfgEventHandlers.hpp
@@ -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););
+ };
+ };
+};
diff --git a/addons/vehiclelock/CfgMagazines.hpp b/addons/vehiclelock/CfgMagazines.hpp
index 198c617509..100df8065b 100644
--- a/addons/vehiclelock/CfgMagazines.hpp
+++ b/addons/vehiclelock/CfgMagazines.hpp
@@ -1,9 +1,10 @@
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
- descriptionShort = "$STR_ACE_Vehicle_Item_Custom_Description";
- count = 1;
- };
+ class CA_Magazine;
+ class ACE_key_customKeyMagazine: CA_Magazine {
+ picture = QUOTE(PATHTOF(ui\keyBlack.paa));
+ 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;
+ };
};
diff --git a/addons/vehiclelock/CfgVehicles.hpp b/addons/vehiclelock/CfgVehicles.hpp
index 5be796c126..1a7da461ca 100644
--- a/addons/vehiclelock/CfgVehicles.hpp
+++ b/addons/vehiclelock/CfgVehicles.hpp
@@ -1,102 +1,107 @@
#define MACRO_LOCK_ACTIONS \
- class ACE_MainActions { \
- class ACE_unlockVehicle { \
- 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)); \
- showDisabled = 0; \
- priority = 0.3; \
- icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \
- }; \
- class ACE_lockVehicle { \
- 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)); \
- showDisabled = 0; \
- priority = 0.2; \
- icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \
- }; \
- class ACE_lockpickVehicle { \
- displayName = "$STR_ACE_Vehicle_Action_Lockpick"; \
- distance = 4; \
- condition = QUOTE([ARR_3(_player, _target, 'canLockpick')] call FUNC(lockpick)); \
- statement = QUOTE([ARR_3(_player, _target, 'startLockpick')] call FUNC(lockpick)); \
- showDisabled = 0; \
- priority = 0.1; \
- }; \
- };
+ class ACE_MainActions { \
+ class ACE_unlockVehicle { \
+ 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('VehicleLock_SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \
+ showDisabled = 0; \
+ priority = 0.3; \
+ icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \
+ }; \
+ class ACE_lockVehicle { \
+ 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('VehicleLock_SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \
+ showDisabled = 0; \
+ priority = 0.2; \
+ icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \
+ }; \
+ class ACE_lockpickVehicle { \
+ displayName = "$STR_ACE_Vehicle_Action_Lockpick"; \
+ distance = 4; \
+ condition = QUOTE([ARR_3(_player, _target, 'canLockpick')] call FUNC(lockpick)); \
+ statement = QUOTE([ARR_3(_player, _target, 'startLockpick')] call FUNC(lockpick)); \
+ showDisabled = 0; \
+ priority = 0.1; \
+ }; \
+ };
class CfgVehicles {
- class LandVehicle;
- class Car: LandVehicle {
- class ACE_Actions {
- MACRO_LOCK_ACTIONS
- };
- };
- class Tank: LandVehicle {
- class ACE_Actions {
- MACRO_LOCK_ACTIONS
- };
- };
- class Air;
- class Helicopter: Air {
- class ACE_Actions {
- MACRO_LOCK_ACTIONS
- };
- };
-
- 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";
- scope = 2;
- isGlobal = 1;
- icon = QUOTE(PATHTOF(ui\IconLock_ca.paa));
- functionPriority = 0;
- class Arguments {
- class SetLockState {
- displayName = "Set Lock State"; // Argument label
- description = "Set lock state for all vehicles on map at start"; // Tooltip description
- typeName = "NUMBER"; // Value type, can be "NUMBER", "STRING" or "BOOL"
- class values {
- class None {name = "As Is"; value = 0; default = 1;};
- class Side {name = "Locked"; value = 1;};
- class Unique {name = "Unlocked"; value = 2;};
+ class LandVehicle;
+ class Car: LandVehicle {
+ class ACE_Actions {
+ MACRO_LOCK_ACTIONS
};
- };
- class LockpickStrength {
- displayName = "Global Lockpick Strength";
- description = "Global 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
- };
};
- class ModuleDescription: ModuleDescription {
- description = "Settings for lockpick strength and initial vehicle lock state. Removes ambiguous lock states.
Source: vehiclelock.pbo";
+ class Tank: LandVehicle {
+ class ACE_Actions {
+ MACRO_LOCK_ACTIONS
+ };
+ };
+ class Air;
+ class Helicopter: Air {
+ class ACE_Actions {
+ MACRO_LOCK_ACTIONS
+ };
};
- };
- class ACE_VehicleLock_ModuleSyncedAssign: Module_F {
- author = "$STR_ACE_Common_ACETeam";
- category = "ACE";
- displayName = "Vehicle Key Assign";
- function = "ACE_VehicleLock_fnc_moduleSync";
- scope = 2;
- isGlobal = 1;
- icon = QUOTE(PATHTOF(ui\IconLock_ca.paa));
- functionPriority = 0;
- class Arguments {};
- class ModuleDescription: ModuleDescription {
- description = "Sync with vehicles and players. Will handout custom keys to players for every synced vehicle. Only valid for objects present at mission start.
Source: vehiclelock.pbo";
- sync[] = {"AnyPlayer", "AnyVehicle"};
+ class Logic;
+ class Module_F: Logic {
+ class ModuleDescription {};
+ };
+ class ACE_VehicleLock_ModuleSetup: Module_F {
+ author = "$STR_ACE_Common_ACETeam";
+ category = "ACE";
+ displayName = "Vehicle Lock Setup";
+ function = QUOTE(DFUNC(moduleInit));
+ scope = 2;
+ 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
+ typeName = "NUMBER"; // Value type, can be "NUMBER", "STRING" or "BOOL"
+ class values {
+ class None {name = "As Is"; value = 0; default = 1;};
+ class Side {name = "Locked"; value = 1;};
+ class Unique {name = "Unlocked"; value = 2;};
+ };
+ };
+ 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
+ };
+ };
+ class ModuleDescription: ModuleDescription {
+ description = "Settings for lockpick strength and initial vehicle lock state. Removes ambiguous lock states.
Source: vehiclelock.pbo";
+ };
+ };
+
+ class ACE_VehicleLock_ModuleSyncedAssign: Module_F {
+ author = "$STR_ACE_Common_ACETeam";
+ category = "ACE";
+ displayName = "Vehicle Key Assign";
+ function = QUOTE(DFUNC(moduleSync));
+ scope = 2;
+ isGlobal = 0;
+ icon = QUOTE(PATHTOF(ui\IconLock_ca.paa));
+ functionPriority = 0;
+ class Arguments {};
+ class ModuleDescription: ModuleDescription {
+ description = "Sync with vehicles and players. Will handout custom keys to players for every synced vehicle. Only valid for objects present at mission start.
Source: vehiclelock.pbo";
+ sync[] = {"AnyPlayer", "AnyVehicle"};
+ };
};
- };
};
diff --git a/addons/vehiclelock/CfgWeapons.hpp b/addons/vehiclelock/CfgWeapons.hpp
index 157fb4bf60..4b20de15d7 100644
--- a/addons/vehiclelock/CfgWeapons.hpp
+++ b/addons/vehiclelock/CfgWeapons.hpp
@@ -1,41 +1,41 @@
class CfgWeapons {
- class InventoryItem_Base_F;
- class ACE_ItemCore;
+ class InventoryItem_Base_F;
+ class ACE_ItemCore;
- class ACE_key_master: ACE_ItemCore {
- author = "$STR_ACE_Common_ACETeam";
- displayName = "Vehicle Key: Master";
- descriptionShort = "$STR_ACE_Vehicle_Item_Master_Description";
- model = "\A3\weapons_F\ammo\mag_univ.p3d";
- picture = QUOTE(PATHTOF(ui\keyBlack.paa));
- scope = 2;
- class ItemInfo: InventoryItem_Base_F {
- mass = 0.1;
- };
- };
- class ACE_key_lockpick: ACE_key_master {
- displayName = "Lockpick";
- descriptionShort = "$STR_ACE_Vehicle_Item_Lockpick_Description";
- picture = QUOTE(PATHTOF(ui\lockpick.paa));
- };
- class ACE_key_west: ACE_key_master {
- displayName = "Vehicle Key: West";
- descriptionShort = "$STR_ACE_Vehicle_Item_West_Description";
- picture = QUOTE(PATHTOF(ui\keyBlue.paa));
- };
- class ACE_key_east: ACE_key_master {
- displayName = "Vehicle Key: East";
- descriptionShort = "$STR_ACE_Vehicle_Item_East_Description";
- picture = QUOTE(PATHTOF(ui\keyRed.paa));
- };
- class ACE_key_indp: ACE_key_master {
- displayName = "Vehicle Key: Independent";
- descriptionShort = "$STR_ACE_Vehicle_Item_Indp_Description";
- picture = QUOTE(PATHTOF(ui\keyPurple.paa));
- };
- class ACE_key_civ: ACE_key_master {
- displayName = "Vehicle Key: Civilian";
- descriptionShort = "$STR_ACE_Vehicle_Item_Civ_Description";
- picture = QUOTE(PATHTOF(ui\keyGreen.paa));
- };
+ class ACE_key_master: ACE_ItemCore {
+ author = "$STR_ACE_Common_ACETeam";
+ displayName = "Vehicle Key: Master";
+ descriptionShort = "$STR_ACE_Vehicle_Item_Master_Description";
+ model = "\A3\weapons_F\ammo\mag_univ.p3d";
+ picture = QUOTE(PATHTOF(ui\keyBlack.paa));
+ scope = 2;
+ class ItemInfo: InventoryItem_Base_F {
+ mass = 0;
+ };
+ };
+ class ACE_key_lockpick: ACE_key_master {
+ displayName = "Lockpick";
+ descriptionShort = "$STR_ACE_Vehicle_Item_Lockpick_Description";
+ picture = QUOTE(PATHTOF(ui\lockpick.paa));
+ };
+ class ACE_key_west: ACE_key_master {
+ displayName = "Vehicle Key: West";
+ descriptionShort = "$STR_ACE_Vehicle_Item_West_Description";
+ picture = QUOTE(PATHTOF(ui\keyBlue.paa));
+ };
+ class ACE_key_east: ACE_key_master {
+ displayName = "Vehicle Key: East";
+ descriptionShort = "$STR_ACE_Vehicle_Item_East_Description";
+ picture = QUOTE(PATHTOF(ui\keyRed.paa));
+ };
+ class ACE_key_indp: ACE_key_master {
+ displayName = "Vehicle Key: Independent";
+ descriptionShort = "$STR_ACE_Vehicle_Item_Indp_Description";
+ picture = QUOTE(PATHTOF(ui\keyPurple.paa));
+ };
+ class ACE_key_civ: ACE_key_master {
+ displayName = "Vehicle Key: Civilian";
+ descriptionShort = "$STR_ACE_Vehicle_Item_Civ_Description";
+ picture = QUOTE(PATHTOF(ui\keyGreen.paa));
+ };
};
diff --git a/addons/vehiclelock/XEH_postInit.sqf b/addons/vehiclelock/XEH_postInit.sqf
new file mode 100644
index 0000000000..c635de2bd3
--- /dev/null
+++ b/addons/vehiclelock/XEH_postInit.sqf
@@ -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);
diff --git a/addons/vehiclelock/XEH_preInit.sqf b/addons/vehiclelock/XEH_preInit.sqf
index 80d1d6335f..bdab28fc75 100644
--- a/addons/vehiclelock/XEH_preInit.sqf
+++ b/addons/vehiclelock/XEH_preInit.sqf
@@ -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;
diff --git a/addons/vehiclelock/config.cpp b/addons/vehiclelock/config.cpp
index 9031987315..700e27b3cb 100644
--- a/addons/vehiclelock/config.cpp
+++ b/addons/vehiclelock/config.cpp
@@ -17,6 +17,10 @@ class ACE_Settings {
value = 10;
typeName = "SCALAR";
};
+ class GVAR(LockVehicleInventory) {
+ value = 0;
+ typeName = "BOOL";
+ };
};
#include "CfgEventHandlers.hpp"
diff --git a/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf b/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf
index c64a0f890d..d683073286 100644
--- a/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf
+++ b/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf
@@ -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