mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
First Pass
This commit is contained in:
parent
5c8614f11c
commit
4e31a4b57f
@ -1 +1 @@
|
||||
AGM_VehicleLock
|
||||
z\ace\addons\vehiclelock
|
5
addons/vehiclelock/CfgEventHandlers.hpp
Normal file
5
addons/vehiclelock/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,5 @@
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
9
addons/vehiclelock/CfgMagazines.hpp
Normal file
9
addons/vehiclelock/CfgMagazines.hpp
Normal file
@ -0,0 +1,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
|
||||
descriptionShort = "$STR_ACE_Vehicle_Item_Custom_Description";
|
||||
count = 1;
|
||||
};
|
||||
};
|
100
addons/vehiclelock/CfgVehicles.hpp
Normal file
100
addons/vehiclelock/CfgVehicles.hpp
Normal file
@ -0,0 +1,100 @@
|
||||
#define MACRO_LOCK_ACTIONS \
|
||||
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 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 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.<br/>Source: vehiclelock.pbo";
|
||||
};
|
||||
};
|
||||
|
||||
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.<br/>Source: vehiclelock.pbo";
|
||||
sync[] = {"AnyPlayer", "AnyVehicle"};
|
||||
};
|
||||
};
|
||||
};
|
41
addons/vehiclelock/CfgWeapons.hpp
Normal file
41
addons/vehiclelock/CfgWeapons.hpp
Normal file
@ -0,0 +1,41 @@
|
||||
class CfgWeapons {
|
||||
class InventoryItem_Base_F;
|
||||
class ACE_ItemCore;
|
||||
|
||||
class ACE_key_master: ACE_ItemCore {
|
||||
author = "$STR_ACE_Core_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));
|
||||
};
|
||||
};
|
14
addons/vehiclelock/XEH_preInit.sqf
Normal file
14
addons/vehiclelock/XEH_preInit.sqf
Normal file
@ -0,0 +1,14 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
PREP(addKeyForVehicle);
|
||||
PREP(getVehicleSideKey);
|
||||
PREP(hasKeyForVehicle);
|
||||
PREP(lockpick);
|
||||
PREP(moduleInit);
|
||||
PREP(moduleSync);
|
||||
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);
|
@ -1,215 +1,22 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class AGM_VehicleLock {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = 0.6;
|
||||
requiredAddons[] = {"AGM_Core", "AGM_Interaction"};
|
||||
version = "0.95";
|
||||
versionStr = "0.95";
|
||||
versionAr[] = {0,95,0};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common", "ace_interaction"};
|
||||
author[] = {"PabstMirror"};
|
||||
authorUrl = "https://github.com/PabstMirror/";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
class AGM_Parameters_Numeric {
|
||||
AGM_VehicleLock_DefaultLockpickStrength = 10;
|
||||
class ACE_Parameters_Numeric {
|
||||
GVAR(DefaultLockpickStrength) = 10;
|
||||
};
|
||||
|
||||
class CfgFunctions {
|
||||
class AGM_VehicleLock {
|
||||
class AGM_VehicleLock {
|
||||
file = "AGM_vehicleLock\functions";
|
||||
class addKeyForVehicle;
|
||||
class getVehicleSideKey;
|
||||
class hasKeyForVehicle;
|
||||
class lockpick;
|
||||
class moduleInit;
|
||||
class moduleSync;
|
||||
class serverSetupCustomKey;
|
||||
class setVehicleLock;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class CfgMagazines {
|
||||
class CA_Magazine;
|
||||
class AGM_magazine_customKey: CA_Magazine {
|
||||
picture = "\AGM_vehicleLock\ui\keyBlack.paa";
|
||||
displayName = "AGM Vehicle Key"; //!!!CANNONT be localized!!!, because it is used as part of the magazineDetail string
|
||||
descriptionShort = "$STR_AGM_Vehicle_Item_Custom_Description";
|
||||
};
|
||||
};
|
||||
|
||||
class CfgWeapons {
|
||||
class InventoryItem_Base_F;
|
||||
class AGM_ItemCore;
|
||||
|
||||
class AGM_item_key_master: AGM_ItemCore {
|
||||
author = "$STR_AGM_Core_AGMTeam";
|
||||
displayName = "Vehicle Key: Master";
|
||||
descriptionShort = "$STR_AGM_Vehicle_Item_Master_Description";
|
||||
model = "\A3\weapons_F\ammo\mag_univ.p3d";
|
||||
picture = "\AGM_vehicleLock\ui\keyBlack.paa";
|
||||
scope = 2;
|
||||
class ItemInfo: InventoryItem_Base_F {
|
||||
mass = 0.1;
|
||||
};
|
||||
};
|
||||
class AGM_item_key_lockpick: AGM_item_key_master {
|
||||
displayName = "Lockpick";
|
||||
descriptionShort = "$STR_AGM_Vehicle_Item_Lockpick_Description";
|
||||
picture = "\AGM_vehicleLock\ui\lockpick.paa";
|
||||
};
|
||||
class AGM_item_key_west: AGM_item_key_master {
|
||||
displayName = "Vehicle Key: West";
|
||||
descriptionShort = "$STR_AGM_Vehicle_Item_West_Description";
|
||||
picture = "\AGM_vehicleLock\ui\keyBlue.paa";
|
||||
};
|
||||
class AGM_item_key_east: AGM_item_key_master {
|
||||
displayName = "Vehicle Key: East";
|
||||
descriptionShort = "$STR_AGM_Vehicle_Item_East_Description";
|
||||
picture = "\AGM_vehicleLock\ui\keyRed.paa";
|
||||
};
|
||||
class AGM_item_key_indp: AGM_item_key_master {
|
||||
displayName = "Vehicle Key: Independent";
|
||||
descriptionShort = "$STR_AGM_Vehicle_Item_Indp_Description";
|
||||
picture = "\AGM_vehicleLock\ui\keyPurple.paa";
|
||||
};
|
||||
class AGM_item_key_civ: AGM_item_key_master {
|
||||
displayName = "Vehicle Key: Civilian";
|
||||
descriptionShort = "$STR_AGM_Vehicle_Item_Civ_Description";
|
||||
picture = "\AGM_vehicleLock\ui\keyGreen.paa";
|
||||
};
|
||||
};
|
||||
|
||||
#define MACRO_LOCK_ACTIONS \
|
||||
class AGM_unlockVehicle { \
|
||||
displayName = "$STR_AGM_Vehicle_Action_UnLock"; \
|
||||
distance = 4; \
|
||||
condition = "([_player, AGM_Interaction_Target] call AGM_VehicleLock_fnc_hasKeyForVehicle) && {(locked AGM_Interaction_Target) in [2, 3]}"; \
|
||||
statement = "[AGM_Interaction_Target, false] call AGM_VehicleLock_fnc_setVehicleLock"; \
|
||||
showDisabled = 1; \
|
||||
priority = 0.3; \
|
||||
icon = "\AGM_vehicleLock\ui\key_menuIcon_ca.paa"; \
|
||||
}; \
|
||||
class AGM_lockVehicle { \
|
||||
displayName = "$STR_AGM_Vehicle_Action_Lock"; \
|
||||
distance = 4; \
|
||||
condition = "([_player, AGM_Interaction_Target] call AGM_VehicleLock_fnc_hasKeyForVehicle) && {(locked AGM_Interaction_Target) in [0, 1]}"; \
|
||||
statement = "[AGM_Interaction_Target, true] call AGM_VehicleLock_fnc_setVehicleLock"; \
|
||||
showDisabled = 1; \
|
||||
priority = 0.2; \
|
||||
icon = "\AGM_vehicleLock\ui\key_menuIcon_ca.paa"; \
|
||||
}; \
|
||||
class AGM_lockpickVehicle { \
|
||||
displayName = "$STR_AGM_Vehicle_Action_Lockpick"; \
|
||||
distance = 4; \
|
||||
condition = "[_player, AGM_Interaction_Target, 'canLockpick'] call AGM_VehicleLock_fnc_lockpick"; \
|
||||
statement = "[_player, AGM_Interaction_Target, 'startLockpick'] call AGM_VehicleLock_fnc_lockpick"; \
|
||||
showDisabled = 0; \
|
||||
priority = 0.1; \
|
||||
};
|
||||
|
||||
class CfgVehicles {
|
||||
class Logic;
|
||||
class Module_F: Logic {
|
||||
class ArgumentsBaseUnits {};
|
||||
class ModuleDescription {};
|
||||
};
|
||||
class AGM_VehicleLock_ModuleSetup: Module_F {
|
||||
author = "$STR_AGM_Core_AGMTeam";
|
||||
category = "AGM";
|
||||
displayName = "Vehicle Lock Setup";
|
||||
function = "AGM_VehicleLock_fnc_moduleInit";
|
||||
scope = 2;
|
||||
isGlobal = 1;
|
||||
icon = "\AGM_VehicleLock\ui\IconLock_ca.paa";
|
||||
functionPriority = 0;
|
||||
class Arguments {
|
||||
class SideKeysAssignment {
|
||||
displayName = "Players Start Side Keys"; // Argument label
|
||||
description = "Which players start wtih side keys (e.g.: agm_item_key_west)"; // Tooltip description
|
||||
typeName = "NUMBER"; // Value type, can be "NUMBER", "STRING" or "BOOL"
|
||||
class values {
|
||||
class Nobody {
|
||||
name = "Nobody";
|
||||
value = 0;
|
||||
default = 1;
|
||||
};
|
||||
class GroupLeads {
|
||||
name = "Group Leads";
|
||||
value = 1;
|
||||
};
|
||||
class Everyone {
|
||||
name = "Everyone";
|
||||
value = 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
class SetLockState {
|
||||
displayName = "Set Lock State"; // Argument label
|
||||
description = "Set lock state for all vehicles on map"; // 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 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, auto assigment of keys at start and initial vehicle lock state.";
|
||||
};
|
||||
};
|
||||
|
||||
class AGM_VehicleLock_ModuleSyncedAssign: Module_F {
|
||||
author = "$STR_AGM_Core_AGMTeam";
|
||||
category = "AGM";
|
||||
displayName = "Vehicle Key Assign";
|
||||
function = "AGM_VehicleLock_fnc_moduleSync";
|
||||
scope = 2;
|
||||
isGlobal = 1;
|
||||
icon = "\AGM_VehicleLock\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.";
|
||||
sync[] = {"AnyPlayer", "AnyVehicle"};
|
||||
};
|
||||
};
|
||||
|
||||
class LandVehicle;
|
||||
class Car: LandVehicle {
|
||||
class AGM_Actions {
|
||||
MACRO_LOCK_ACTIONS
|
||||
};
|
||||
};
|
||||
class Tank: LandVehicle {
|
||||
class AGM_Actions {
|
||||
MACRO_LOCK_ACTIONS
|
||||
};
|
||||
};
|
||||
class Air;
|
||||
class Helicopter: Air {
|
||||
class AGM_Actions {
|
||||
MACRO_LOCK_ACTIONS
|
||||
};
|
||||
};
|
||||
};
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgMagazines.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
Name: AGM_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 - false: side key)
|
||||
|
||||
Returns:
|
||||
Nothing
|
||||
|
||||
Example:
|
||||
[bob, car1, true] call AGM_VehicleLock_fnc_addKeyForVehicle;
|
||||
*/
|
||||
|
||||
#define CUSTOM_KEY_CLASSNAME "AGM_magazine_customKey"
|
||||
|
||||
private ["_unit","_veh","_useCustom","_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;
|
||||
|
||||
if (isNull _unit) exitWith {
|
||||
["addKeyForVehicleClient: null unit"] call BIS_fnc_error;
|
||||
};
|
||||
if (isNull _veh) exitWith {
|
||||
["addKeyForVehicleClient: null vehicle"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
if (_useCustom) then {
|
||||
_previousMags = magazinesDetail _unit;
|
||||
_unit addMagazine CUSTOM_KEY_CLASSNAME;
|
||||
_newMags = (magazinesDetail _unit) - _previousMags;
|
||||
if ((count _newMags) < 1) exitWith {
|
||||
["AGM_VehicleLock_fnc_addKeyForVehicle: failed to add magazine (inventory full?)"] call BIS_fnc_error;
|
||||
};
|
||||
_keyMagazine = _newMags select 0;
|
||||
[[_veh, _keyMagazine], "AGM_VehicleLock_fnc_serverSetupCustomKey", 1] call AGM_Core_fnc_execRemoteFnc;
|
||||
} else {
|
||||
_keyName = [_veh] call AGM_VehicleLock_fnc_getVehicleSideKey;
|
||||
_unit addItem _keyName;
|
||||
};
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
Name: AGM_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 AGM_VehicleLock_fnc_getVehicleSideKey;
|
||||
*/
|
||||
|
||||
private ["_veh","_vehConfigSide","_vehSide","_returnValue"];
|
||||
|
||||
_veh = [_this, 0, objNull, [objNull]] call bis_fnc_param;
|
||||
if (isNull _veh) exitWith {["AGM_VehicleLock_fnc_getVehicleSideKey: null vehicle"] call BIS_fnc_error; ""};
|
||||
|
||||
_vehConfigSide = [_veh, true] call bis_fnc_objectSide;
|
||||
_vehSide = _veh getVariable ["agm_lock_side", _vehConfigSide];
|
||||
|
||||
_returnValue = "";
|
||||
|
||||
switch (_vehSide) do {
|
||||
case (west): {_returnValue = "AGM_item_key_west"};
|
||||
case (east): {_returnValue = "AGM_item_key_east"};
|
||||
case (resistance): {_returnValue = "AGM_item_key_indp"};
|
||||
case (civilian): {_returnValue = "AGM_item_key_civ"};
|
||||
};
|
||||
|
||||
_returnValue
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
Name: AGM_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 AGM_VehicleLock_fnc_hasKeyForVehicle;
|
||||
*/
|
||||
|
||||
private ["_unit","_veh","_returnValue","_sideKeyName","_customKeys"];
|
||||
|
||||
_unit = [_this, 0, objNull, [objNull]] call bis_fnc_param;
|
||||
_veh = [_this, 1, objNull, [objNull]] call bis_fnc_param;
|
||||
|
||||
if (isNull _unit) exitWith {["AGM_VehicleLock_fnc_hasKeyForVehicle: null unit"] call BIS_fnc_error; false};
|
||||
if (isNull _veh) exitWith {["AGM_VehicleLock_fnc_hasKeyForVehicle: null vehicle"] call BIS_fnc_error; false};
|
||||
|
||||
_returnValue = false;
|
||||
|
||||
//Master can open anything "no matter what"
|
||||
if ("AGM_item_key_master" in (items _unit)) then {_returnValue = true};
|
||||
|
||||
//Check side key
|
||||
_sideKeyName = [_veh] call AGM_VehicleLock_fnc_getVehicleSideKey;
|
||||
if (_sideKeyName in (items _unit)) then {_returnValue = true};
|
||||
|
||||
//Check custom keys
|
||||
_customKeys = _veh getVariable ["agm_lock_customKeys", []];
|
||||
{
|
||||
if (_x in (magazinesDetail _unit)) then {_returnValue = true;};
|
||||
} forEach _customKeys;
|
||||
|
||||
_returnValue
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
Name: AGM_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:
|
||||
[AGM_player, AGM_Interaction_Target, 'canLockpick'] call AGM_VehicleLock_fnc_lockpick
|
||||
*/
|
||||
private ["_unit","_veh","_funcType","_vehLockpickStrenth","_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;
|
||||
|
||||
if (isNull _unit) exitWith {
|
||||
["AGM_VehicleLock_fnc_lockpick: null unit"] call BIS_fnc_error;
|
||||
false
|
||||
};
|
||||
if (isNull _veh) exitWith {
|
||||
["AGM_VehicleLock_fnc_lockpick: null vehicle"] call BIS_fnc_error;
|
||||
false
|
||||
};
|
||||
|
||||
//need lockpick item
|
||||
if (!("AGM_item_key_lockpick" in (items _unit))) exitWith {
|
||||
false
|
||||
};
|
||||
|
||||
_vehLockpickStrenth = _veh getVariable["agm_vehicleLock_pickStr", AGM_VehicleLock_DefaultLockpickStrength];
|
||||
if (typeName _vehLockpickStrenth != "SCALAR") exitWith {
|
||||
["AGM_VehicleLock_fnc_lockpick: agm_vehicleLock_pickStr invalid: (%1)", _veh] call BIS_fnc_error;
|
||||
false
|
||||
};
|
||||
|
||||
//-1 indicates unpickable lock
|
||||
if (_vehLockpickStrenth < 0) exitWith {
|
||||
false
|
||||
};
|
||||
|
||||
_returnValue = false;
|
||||
|
||||
switch (true) do {
|
||||
case (_funcType == "canLockpick"): {
|
||||
_returnValue = true;
|
||||
};
|
||||
case (_funcType == "startLockpick"): {
|
||||
[_vehLockpickStrenth, [_unit, _veh, "finishLockpick"], "AGM_VehicleLock_fnc_lockpick", (localize "STR_AGM_Vehicle_Action_LockpickInUse")] call AGM_Core_fnc_progressBar;
|
||||
};
|
||||
case (_funcType == "finishLockpick"): {
|
||||
[_veh, false] call AGM_VehicleLock_fnc_setVehicleLock;
|
||||
};
|
||||
default {
|
||||
["AGM_VehicleLock_fnc_lockpick: bad function type"] call BIS_fnc_error;
|
||||
};
|
||||
};
|
||||
|
||||
_returnValue;
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
Name: AGM_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
|
||||
|
||||
Returns:
|
||||
Nothing
|
||||
|
||||
Example:
|
||||
called from module
|
||||
*/
|
||||
|
||||
_this spawn {
|
||||
|
||||
private ["_logic", "_sideKeysAssignment", "_setLockState", "_lock", "_giveSideKey", "_keyClassName"];
|
||||
_logic = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
|
||||
|
||||
_sideKeysAssignment = _logic getVariable["SideKeysAssignment", 0];
|
||||
_setLockState = _logic getVariable["SetLockState", 0];
|
||||
|
||||
if (isServer) then {
|
||||
[_logic, "AGM_VehicleLock_DefaultLockpickStrength", "LockpickStrength"] call AGM_Core_fnc_readNumericParameterFromModule;
|
||||
|
||||
{ //set lock state
|
||||
_lock =
|
||||
switch (_setLockState) do {
|
||||
case (0): {(locked _x) in [2, 3]};
|
||||
case (1):{true};
|
||||
case (2):{false};
|
||||
};
|
||||
[_x, _lock] call AGM_VehicleLock_fnc_setVehicleLock;
|
||||
}
|
||||
forEach vehicles;
|
||||
};
|
||||
|
||||
if (hasInterface) then {
|
||||
waitUntil {player == player};
|
||||
waitUntil {alive player};
|
||||
sleep 5; //need to wait for other gear-assign scripts to finish
|
||||
|
||||
_giveSideKey =
|
||||
switch (_sideKeysAssignment) do {
|
||||
case (0): {false};
|
||||
case (1): {(leader player) == player};
|
||||
case (2): {true};
|
||||
};
|
||||
|
||||
if (_giveSideKey) then {
|
||||
_keyClassName = switch (playerside) do {
|
||||
case (west): {"AGM_item_key_west"};
|
||||
case (east): {"AGM_item_key_east"};
|
||||
case (resistance): {"AGM_item_key_indp"};
|
||||
case (civilian): {"AGM_item_key_civ"};
|
||||
default {""};
|
||||
};
|
||||
if (_keyClassName != "") then {
|
||||
player addItem _keyClassName;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
Name: AGM_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
|
||||
*/
|
||||
|
||||
_this spawn {
|
||||
private ["_logic","_syncedObjects","_listOfVehicles"];
|
||||
|
||||
_logic = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
|
||||
_syncedObjects = [_this, 1, [], [[]]] call BIS_fnc_param;
|
||||
|
||||
if (hasInterface) then {
|
||||
waitUntil {player == player};
|
||||
waitUntil {alive player};
|
||||
sleep 5; //need to wait for other gear-assign scripts to finish
|
||||
|
||||
_listOfVehicles = []; {
|
||||
if ((_x isKindOf "Car") || (_x isKindOf "Tank") || (_x isKindOf "Helicopter")) then {
|
||||
_listOfVehicles pushBack _x;
|
||||
};
|
||||
} forEach _syncedObjects;
|
||||
|
||||
if ((count _listOfVehicles) == 0) exitWith {
|
||||
["AGM_VehicleLock_fnc_moduleSync: no valid vehicles synced"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
if (player in _syncedObjects) then {
|
||||
{
|
||||
[player, _x, true] call AGM_VehicleLock_fnc_addKeyForVehicle;
|
||||
} forEach _listOfVehicles;
|
||||
};
|
||||
};
|
||||
};
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
Name: AGM_VehicleLock_fnc_serverSetupCustomKey
|
||||
|
||||
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, "todo"] call AGM_VehicleLock_fnc_serverSetupCustomKey;
|
||||
*/
|
||||
|
||||
private ["_veh","_key","_currentKeys"];
|
||||
|
||||
_veh = [_this, 0, objNull, [objNull]] call bis_fnc_param;
|
||||
_key = [_this, 1, "", [""]] call bis_fnc_param;
|
||||
|
||||
if (!isServer) exitWith {["AGM_VehicleLock_fnc_serverSetupCustomKey: only run on server"] call BIS_fnc_error;};
|
||||
if (_key == "") exitWith {["AGM_VehicleLock_fnc_serverSetupCustomKey: empty key string"] call BIS_fnc_error;};
|
||||
|
||||
//Want this as atomic as possible
|
||||
|
||||
_currentKeys = _veh getVariable ["agm_lock_customKeys", []];
|
||||
_currentKeys pushBack _key;
|
||||
_veh setVariable ["agm_lock_customKeys", _currentKeys, true];
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
Name: AGM_VehicleLock_fnc_setVehicleLock
|
||||
|
||||
Author: Pabst Mirror
|
||||
|
||||
Description:
|
||||
Sets a vehicle lock state (MP safe)
|
||||
|
||||
Parameters:
|
||||
0: OBJECT - vehicle
|
||||
1: BOOL - new lock state
|
||||
|
||||
Returns:
|
||||
Nothing
|
||||
|
||||
Example:
|
||||
[tank1, false] call AGM_VehicleLock_fnc_setVehicleLock;
|
||||
*/
|
||||
|
||||
private ["_veh","_isLocked","_lockNumber"];
|
||||
|
||||
_veh = [_this, 0, objNull, [objNull]] call bis_fnc_param;
|
||||
_isLocked = [_this, 1, false, [false]] call bis_fnc_param;
|
||||
|
||||
if (isNull _veh) exitWith {["AGM_VehicleLock_fnc_setVehicleLock: null vehicle"] call BIS_fnc_error;};
|
||||
|
||||
_lockNumber = if (_isLocked) then {2} else {0};
|
||||
[[_veh, _lockNumber], "{(_this select 0) lock (_this select 1)}", 2] call AGM_Core_fnc_execRemoteFnc;
|
||||
_veh setVariable ["AGM_LockedInventory", _isLocked, true];
|
45
addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf
Normal file
45
addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
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;
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_veh","_useCustom","_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;
|
||||
|
||||
if (isNull _unit) exitWith {["addKeyForVehicleClient: null unit"] call BIS_fnc_error;};
|
||||
if (isNull _veh) exitWith {["addKeyForVehicleClient: null vehicle"] call BIS_fnc_error;};
|
||||
|
||||
if (_useCustom) then {
|
||||
_previousMags = magazinesDetail _unit;
|
||||
_unit addMagazine ["ACE_key_customKeyMagazine", 1];
|
||||
_newMags = (magazinesDetail _unit) - _previousMags;
|
||||
if ((count _newMags) == 0) exitWith {
|
||||
["ACE_VehicleLock_fnc_addKeyForVehicle: failed to add magazine (inventory full?)"] call BIS_fnc_error;
|
||||
};
|
||||
_keyMagazine = _newMags select 0;
|
||||
TRACE_2("setting up key on server",_veh,_keyMagazine);
|
||||
["SetupCustomKey", [_veh, _keyMagazine]] call EFUNC(common,serverEvent);
|
||||
} else {
|
||||
_keyName = [_veh] call FUNC(getVehicleSideKey);
|
||||
_unit addItem _keyName;
|
||||
};
|
38
addons/vehiclelock/functions/fnc_getVehicleSideKey.sqf
Normal file
38
addons/vehiclelock/functions/fnc_getVehicleSideKey.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
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;
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_veh","_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; ""};
|
||||
|
||||
_vehConfigSide = [_veh, true] call BIS_fnc_objectSide;
|
||||
_vehSide = _veh getVariable [QGVAR(lock_side), _vehConfigSide];
|
||||
|
||||
_returnValue = "";
|
||||
|
||||
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"};
|
||||
};
|
||||
|
||||
_returnValue
|
45
addons/vehiclelock/functions/fnc_hasKeyForVehicle.sqf
Normal file
45
addons/vehiclelock/functions/fnc_hasKeyForVehicle.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
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;
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_veh","_returnValue","_sideKeyName","_customKeys"];
|
||||
|
||||
_unit = [_this, 0, objNull, [objNull]] call bis_fnc_param;
|
||||
_veh = [_this, 1, objNull, [objNull]] call bis_fnc_param;
|
||||
|
||||
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};
|
||||
|
||||
_returnValue = false;
|
||||
|
||||
//Master can open anything "no matter what"
|
||||
if ("ACE_key_master" in (items _unit)) then {_returnValue = true};
|
||||
|
||||
//Check side key
|
||||
_sideKeyName = [_veh] call FUNC(getVehicleSideKey);
|
||||
if (_sideKeyName in (items _unit)) then {_returnValue = true};
|
||||
|
||||
//Check custom keys
|
||||
_customKeys = _veh getVariable [QGVAR(customKeys), []];
|
||||
{
|
||||
if (_x in (magazinesDetail _unit)) then {_returnValue = true;};
|
||||
} forEach _customKeys;
|
||||
|
||||
_returnValue
|
74
addons/vehiclelock/functions/fnc_lockpick.sqf
Normal file
74
addons/vehiclelock/functions/fnc_lockpick.sqf
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_veh","_funcType","_vehLockpickStrenth","_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;
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
//need lockpick item
|
||||
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
|
||||
};
|
||||
|
||||
//-1 indicates unpickable lock
|
||||
if (_vehLockpickStrenth < 0) exitWith {
|
||||
false
|
||||
};
|
||||
|
||||
_returnValue = false;
|
||||
|
||||
switch (true) do {
|
||||
case (_funcType == "canLockpick"): {
|
||||
_returnValue = true;
|
||||
};
|
||||
case (_funcType == "startLockpick"): {
|
||||
[_vehLockpickStrenth, [_unit, _veh, "finishLockpick"], "ACE_VehicleLock_fnc_lockpick", (localize "STR_ACE_Vehicle_Action_LockpickInUse")] call EFUNC(common,progressBar);
|
||||
};
|
||||
case (_funcType == "finishLockpick"): {
|
||||
["SetVehicleLock", [_veh], [_veh, false]] call EFUNC(common,targetEvent);
|
||||
};
|
||||
default {
|
||||
["ACE_VehicleLock_fnc_lockpick: bad function type"] call BIS_fnc_error;
|
||||
};
|
||||
};
|
||||
|
||||
_returnValue;
|
51
addons/vehiclelock/functions/fnc_moduleInit.sqf
Normal file
51
addons/vehiclelock/functions/fnc_moduleInit.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_sideKeysAssignment", "_setLockState", "_lock"];
|
||||
|
||||
PARAMS_3(_logic,_syncedUnits,_activated);
|
||||
|
||||
if (!_activated) exitWith {WARNING("Vehicle Lock Init Module - placed but not active");};
|
||||
|
||||
_sideKeysAssignment = _logic getVariable["SideKeysAssignment", 0];
|
||||
_setLockState = _logic getVariable["SetLockState", 0];
|
||||
|
||||
if (isServer) then {
|
||||
[_logic, QGVAR(DefaultLockpickStrength), "LockpickStrength"] call EFUNC(common,readNumericParameterFromModule);
|
||||
};
|
||||
|
||||
//Run at mission start (anyone besides JIPs)
|
||||
if (isServer || {player == player}) then {
|
||||
{
|
||||
if ((local _x) && {(_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]};
|
||||
case (1):{true};
|
||||
case (2):{false};
|
||||
};
|
||||
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);
|
||||
};
|
||||
};
|
||||
} forEach vehicles;
|
||||
};
|
52
addons/vehiclelock/functions/fnc_moduleSync.sqf
Normal file
52
addons/vehiclelock/functions/fnc_moduleSync.sqf
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
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;
|
||||
_listOfVehicles = [];
|
||||
{
|
||||
if ((_x isKindOf "Car") || (_x isKindOf "Tank") || (_x isKindOf "Helicopter")) then {
|
||||
_listOfVehicles pushBack _x;
|
||||
};
|
||||
} forEach _syncedObjects;
|
||||
|
||||
if ((count _listOfVehicles) == 0) exitWith { //Verbose error for mission makers
|
||||
["ACE_VehicleLock_fnc_moduleSync: no vehicles synced"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
{
|
||||
_unit = _x;
|
||||
if (_unit isKindOf "CAManBase") then {
|
||||
{
|
||||
[_unit, _x, true] call FUNC(addKeyForVehicle);
|
||||
} forEach _listOfVehicles;
|
||||
};
|
||||
} forEach _syncedObjects;
|
||||
};
|
||||
|
||||
//Wait to add keys until various gear assigns have finished (~5 seconds)
|
||||
[_addKeyAfterGearAssign, [_syncedObjects], 5, 1] call EFUNC(common,waitAndExecute);
|
31
addons/vehiclelock/functions/fnc_serverSetupCustomKeyEH.sqf
Normal file
31
addons/vehiclelock/functions/fnc_serverSetupCustomKeyEH.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
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;
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_currentKeys"];
|
||||
|
||||
PARAMS_2(_veh,_key);
|
||||
|
||||
if (!isServer) exitWith {ERROR("only run on server");};
|
||||
if (_key == "") exitWith {ERROR("empty key string");};
|
||||
|
||||
_currentKeys = _veh getVariable [QGVAR(customKeys), []];
|
||||
_currentKeys pushBack _key;
|
||||
_veh setVariable [QGVAR(customKeys), _currentKeys, true];
|
33
addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf
Normal file
33
addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
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;
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_veh","_isLocked","_lockNumber"];
|
||||
|
||||
_veh = [_this, 0, objNull, [objNull]] call bis_fnc_param;
|
||||
_isLocked = [_this, 1, false, [false]] call bis_fnc_param;
|
||||
|
||||
_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
|
1
addons/vehiclelock/functions/script_component.hpp
Normal file
1
addons/vehiclelock/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\vehiclelock\script_component.hpp"
|
37
addons/vehiclelock/readme.md
Normal file
37
addons/vehiclelock/readme.md
Normal file
@ -0,0 +1,37 @@
|
||||
Author: PabstMirror
|
||||
|
||||
Adds keys as an item, to lock and unlock vehicles.
|
||||
Primary target would be role play or TVT, but has uses in all game types, even co-ops (DAC AI will steal unlocked vehicles)
|
||||
|
||||
Two key modes (can be used together):
|
||||
Simple Side based keys (e.g. "ACE_key_west" works on any hunter)
|
||||
Custom keys (one key will only open a specific vehicle and nothing else)
|
||||
|
||||
Items Added:
|
||||
|
||||
`ACE_key_lockpick`
|
||||
`ACE_key_master`
|
||||
`ACE_key_west`
|
||||
`ACE_key_east`
|
||||
`ACE_key_indp`
|
||||
`ACE_key_civ`
|
||||
|
||||
Magazine added (should never be manualy added, needs to be 'programed' to work on a vehicle):
|
||||
`ACE_key_customKeyMagazine`
|
||||
|
||||
For Mission Makers:
|
||||
|
||||
Modules:
|
||||
Vehicle Lock Setup - Settings for lockpick strength and initial vehicle lock state.
|
||||
Vehicle Key Assign - Sync with vehicles and players. Will handout custom keys to players for every synced vehicle.
|
||||
|
||||
Global Variable:
|
||||
`ACE_VehicleLock_DefaultLockpickStrength` - Time in seconds to lock pick globaly, can also set per-vehicle (-1 would disable)
|
||||
|
||||
Vehicle setVariables:
|
||||
`ACE_lock_side` - SIDE: overrides a vehicle's side, allows indfor to use little-bird's with indp keys
|
||||
`ACE_vehicleLock_pickStr` - NUMBER: secons, determines how long lockpicking with take, overrides ACE_VehicleLock_DefaultLockpickStrength
|
||||
`ACE_lock_customKeys` - ARRAY: array of strings of magazinesDetails, use the following function to modify
|
||||
|
||||
`[bob, car1, true] call ACE_VehicleLock_fnc_addKeyForVehicle;`
|
||||
will add a `ACE_magazine_customKey` to bob and program it to work on car1
|
@ -1,37 +0,0 @@
|
||||
Adds keys as an item, to lock and unlock vehicles.
|
||||
Primary target would be role play or TVT, but has uses in all game types, even co-ops (DAC AI will steal unlocked vehicles)
|
||||
|
||||
Modules allow fast setup, or can manualy add items and set variables.
|
||||
|
||||
Two key modes (can be used together):
|
||||
Simple Side based keys (e.g. "AGM_item_key_west" works on any hunter)
|
||||
Custom keys (one key will only open a specific vehicle and nothing else)
|
||||
|
||||
Items Added:
|
||||
|
||||
AGM_item_key_lockpick
|
||||
AGM_item_key_master
|
||||
AGM_item_key_west
|
||||
AGM_item_key_east
|
||||
AGM_item_key_indp
|
||||
AGM_item_key_civ
|
||||
|
||||
Magazine added (should never be manualy added, needs to be 'programed' to work on a vehicle):
|
||||
AGM_magazine_customKey
|
||||
|
||||
For Mission Makers:
|
||||
|
||||
Modules:
|
||||
Vehicle Lock Setup - Settings for lockpick strength, auto assigment of keys at start and initial vehicle lock state.
|
||||
Vehicle Key Assign - Sync with vehicles and players. Will handout custom keys to players for every synced vehicle.
|
||||
|
||||
Global Variable:
|
||||
AGM_VehicleLock_DefaultLockpickStrength - Time in seconds to lock pick globaly, can also set per-vehicle (-1 would disable)
|
||||
|
||||
Vehicle setVariables:
|
||||
agm_lock_side - SIDE: overrides a vehicle's side, allows indfor to use little-bird's with indp keys
|
||||
agm_vehicleLock_pickStr - NUMBER: secons, determines how long lockpicking with take, overrides AGM_VehicleLock_DefaultLockpickStrength
|
||||
agm_lock_customKeys - ARRAY: array of strings of magazinesDetails, use the following function to modify
|
||||
|
||||
[bob, car1, true] call AGM_VehicleLock_fnc_addKeyForVehicle;
|
||||
will add a "AGM_magazine_customKey" to bob and program it to work on car1
|
15
addons/vehiclelock/script_component.hpp
Normal file
15
addons/vehiclelock/script_component.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
#define COMPONENT vehiclelock
|
||||
|
||||
#define DEBUG_MODE_FULL
|
||||
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_VEHICLELOCK
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_VEHICLELOCK
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_VEHICLELOCK
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler - 2014-12-24 -->
|
||||
<Project name="AGM">
|
||||
<Project name="ACE">
|
||||
<Package name="VehicleLock">
|
||||
<Key ID="STR_AGM_Vehicle_Action_UnLock">
|
||||
<Key ID="STR_ACE_Vehicle_Action_UnLock">
|
||||
<English>Unlock Vehicle</English>
|
||||
<German>Fahrzeug aufschließen</German>
|
||||
<Spanish>Vehículo abierto</Spanish>
|
||||
@ -12,7 +12,7 @@
|
||||
<Hungarian>Jármű nyitása</Hungarian>
|
||||
<Russian>Открыть машину</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_AGM_Vehicle_Action_Lock">
|
||||
<Key ID="STR_ACE_Vehicle_Action_Lock">
|
||||
<English>Lock Vehicle</English>
|
||||
<German>Fahrzeug abschließen</German>
|
||||
<Spanish>Vehículo cerrado</Spanish>
|
||||
@ -22,7 +22,7 @@
|
||||
<Hungarian>Jármű zárása</Hungarian>
|
||||
<Russian>Закрыть машину</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_AGM_Vehicle_Action_Lockpick">
|
||||
<Key ID="STR_ACE_Vehicle_Action_Lockpick">
|
||||
<English>Lockpick Vehicle</English>
|
||||
<German>Fahrzeug knacken</German>
|
||||
<Spanish>Forzar vehículo</Spanish>
|
||||
@ -32,7 +32,7 @@
|
||||
<Hungarian>Jármű feltörése</Hungarian>
|
||||
<Russian>Взломать замок</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_AGM_Vehicle_Action_LockpickInUse">
|
||||
<Key ID="STR_ACE_Vehicle_Action_LockpickInUse">
|
||||
<English>Picking Lock....</English>
|
||||
<German>Schloss knacken...</German>
|
||||
<Spanish>Forzando cierre...</Spanish>
|
||||
@ -42,7 +42,7 @@
|
||||
<Hungarian>Feltörés...</Hungarian>
|
||||
<Russian>Взламываем замок...</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_AGM_Vehicle_Item_Custom_Description">
|
||||
<Key ID="STR_ACE_Vehicle_Item_Custom_Description">
|
||||
<English>A custom key that will open a specific vehicle.</English>
|
||||
<German>Ein Schlüssel der ein bestimmtes Fahrzeug aufschließt.</German>
|
||||
<Spanish>Una llave concreta abrirá un vehículo concreto.</Spanish>
|
||||
@ -52,7 +52,7 @@
|
||||
<Hungarian>Kulcs egy járműhez</Hungarian>
|
||||
<Russian>Ключ от конкретной машины.</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_AGM_Vehicle_Item_Master_Description">
|
||||
<Key ID="STR_ACE_Vehicle_Item_Master_Description">
|
||||
<English>A Master Key will open any lock, no matter what!</English>
|
||||
<German>Ein Generalschlüssel der jedes Schloss öffnet...</German>
|
||||
<Spanish>Una llave maestra abrirá cualquier cierre, no importa cual!</Spanish>
|
||||
@ -62,7 +62,7 @@
|
||||
<Hungarian>Általános kulcs minden járműhez</Hungarian>
|
||||
<Russian>Универсальный ключ, открывающий любой замок.</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_AGM_Vehicle_Item_Lockpick_Description">
|
||||
<Key ID="STR_ACE_Vehicle_Item_Lockpick_Description">
|
||||
<English>A lockpick set that can pick the locks of most vehicles.</English>
|
||||
<German>Ein Dietrich der die meisten Fahrzeugschlösser knacken kann...</German>
|
||||
<Spanish>Un set de ganzúas puede abrir la mayoría de cerraduras de vehículos.</Spanish>
|
||||
@ -72,7 +72,7 @@
|
||||
<Hungarian>Álkulcs melyik minden járműt nyitni tud</Hungarian>
|
||||
<Russian>Набор отмычек, которым можно взломать почти любую машину.</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_AGM_Vehicle_Item_West_Description">
|
||||
<Key ID="STR_ACE_Vehicle_Item_West_Description">
|
||||
<English>A key that should open most WEST vehicles.</English>
|
||||
<German>Ein Schlüssel der die meisten westlichen Fahrzeuge öffnen sollte...</German>
|
||||
<Spanish>Una llave que puede abrir la mayoría de vehículos occidentales.</Spanish>
|
||||
@ -82,7 +82,7 @@
|
||||
<Hungarian>Általános kulcs WEST járművekhez</Hungarian>
|
||||
<Russian>Ключ для открытия большинства машин Запада.</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_AGM_Vehicle_Item_East_Description">
|
||||
<Key ID="STR_ACE_Vehicle_Item_East_Description">
|
||||
<English>A key that should open most EAST vehicle.</English>
|
||||
<German>Ein Schlüssel der die meisten östlichen Fahrzeuge öffnen sollte...</German>
|
||||
<Spanish>Una llave que puede abrir la mayoría de vehículos orientales.</Spanish>
|
||||
@ -92,7 +92,7 @@
|
||||
<Czech>Klíč který by měl otevřít vetšinu Východních vozidel.</Czech>
|
||||
<Russian>Ключ для открытия большинства машин Востока.</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_AGM_Vehicle_Item_Indp_Description">
|
||||
<Key ID="STR_ACE_Vehicle_Item_Indp_Description">
|
||||
<English>A key that should open most INDEP vehicle.</English>
|
||||
<German>Ein Schlüssel der die meisten Fahrzeuge der Aufständischen öffnen sollte...</German>
|
||||
<Spanish>Una llave que puede abrir la mayoría de vehículos independientes.</Spanish>
|
||||
@ -102,7 +102,7 @@
|
||||
<Czech>Klíč který by měl otevřít většinu Nezávislých vozidel.</Czech>
|
||||
<Russian>Ключ для открытия большинства машин Независимых.</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_AGM_Vehicle_Item_Civ_Description">
|
||||
<Key ID="STR_ACE_Vehicle_Item_Civ_Description">
|
||||
<English>A key that should open most CIV vehicle.</English>
|
||||
<German>Ein Schlüssel der die meisten zivilen Fahrzeuge öffnen sollte...</German>
|
||||
<Spanish>Una llave que puede abrir la mayoría de vehículos civiles.</Spanish>
|
||||
|
Loading…
Reference in New Issue
Block a user