Merge remote-tracking branch 'origin/master'

This commit is contained in:
KoffeinFlummi 2015-01-28 22:17:11 +01:00
commit beb193d485
50 changed files with 874 additions and 794 deletions

View File

@ -1 +0,0 @@
AGM_VehicleLock

View File

@ -1,215 +0,0 @@
class CfgPatches {
class AGM_VehicleLock {
units[] = {};
weapons[] = {};
requiredVersion = 0.6;
requiredAddons[] = {"AGM_Core", "AGM_Interaction"};
version = "0.95";
versionStr = "0.95";
versionAr[] = {0,95,0};
author[] = {"PabstMirror"};
authorUrl = "https://github.com/PabstMirror/";
};
};
class AGM_Parameters_Numeric {
AGM_VehicleLock_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
};
};
};

View File

@ -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;
};

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;
};
};
};
};

View File

@ -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;
};
};
};

View File

@ -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];

View File

@ -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];

View File

@ -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

View File

@ -1,94 +1,80 @@
class ACE_gui_RscProgress;
class ACE_gui_staticBase;
class GVAR(ProgressBar_Dialog) {
idd = -1;
movingEnable = false;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(ctrlProgressBar)),(_this select 0) displayCtrl 1)]; uiNamespace setVariable [ARR_2(QUOTE(QGVAR(ctrlProgressBarTitle)),(_this select 0) displayCtrl 2)];);
objects[] = {};
idd = -1;
movingEnable = false;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(ctrlProgressBar)),(_this select 0) displayCtrl 1)]; uiNamespace setVariable [ARR_2(QUOTE(QGVAR(ctrlProgressBarTitle)),(_this select 0) displayCtrl 2)];);
objects[] = {};
class controlsBackground {
class Background {
idc = -1;
moving = 0;
font = "TahomaB";
text = "";
sizeEx = 0;
lineSpacing = 0;
access = 0;
type = 0;
style = 0;
size = 1;
colorBackground[] = {0, 0, 0, 0.1};
colorText[] = {0, 0, 0, 0};
x = "safezoneX";
y = "safezoneY";
w = "safezoneW";
h = "safezoneH";
};
class Progress_Bar {
idc = 1;
moving = 0;
text = "";
font = "PuristaMedium";
sizeEx = "1 / 40 / (getResolution select 5)";// * safezoneX / safezoneXAbs";
lineSpacing = 0;
access = 0;
type = 0;
style = 2;
size = 1;
colorBackground[] = {1, 0.647, 0, 0.5};
colorText[] = {1,1,1,1};
x = "safezoneX + 0.1 * safezoneW";
y = "safezoneY + 0.2 * safezoneH";
w = "0.0 * safezoneW";
h = "0.01 * safezoneH";
};
class Title_Bar : Progress_Bar {
idc = 2;
//type = 13;
//size = 1;
colorBackground[] = {0, 0, 0, 0};
x = "safezoneX + 0.1 * safezoneW";
y = "safezoneY + 0.1 * safezoneH";
w = "0.8 * safezoneW";
h = "0.05 * safezoneH";
/*class Attributes {
font = "TahomaB";
color = "#000000";
align = "center";
valign = "middle";
shadow = false;
shadowColor = "#ff0000";
size = "1";
};*/
};
class controlsBackground {
class Background {
idc = -1;
moving = 0;
font = "TahomaB";
text = "";
sizeEx = 0;
lineSpacing = 0;
access = 0;
type = 0;
style = 0;
size = 1;
colorBackground[] = {0, 0, 0, 0.1};
colorText[] = {0, 0, 0, 0};
x = "safezoneX";
y = "safezoneY";
w = "safezoneW";
h = "safezoneH";
};
class Progress: ACE_gui_RscProgress {
idc = 1;
x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "0.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = ".8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
colorFrame[] = {0,0,0,0.025};
colorBar[] = {0.27,0.5,0.31,0.8};
texture = "#(argb,8,8,3)color(1,1,1,0.7)";
};
class Title_Bar : ACE_gui_staticBase {
idc = 2;
style = 0x22;
colorBackground[] = {0, 0, 0, 0};
colorText[] = {1, 1, 1, 1};
x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "0 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
};
};
class GVAR(DisableMouse_Dialog) {
idd = -1;
movingEnable = false;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(dlgDisableMouse)),_this select 0)];);
objects[] = {};
class controlsBackground {
class Background {
idc = -1;
moving = 0;
font = "TahomaB";
text = "";
sizeEx = 0;
lineSpacing = 0;
access = 0;
type = 0;
style = 0;
size = 1;
colorBackground[] = {0, 0, 0, 0};//0.5
colorText[] = {0, 0, 0, 0};
x = "safezoneX";
y = "safezoneY";
w = "safezoneW";
h = "safezoneH";
};
idd = -1;
movingEnable = false;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(dlgDisableMouse)),_this select 0)];);
objects[] = {};
class controlsBackground {
class Background {
idc = -1;
moving = 0;
font = "TahomaB";
text = "";
sizeEx = 0;
lineSpacing = 0;
access = 0;
type = 0;
style = 0;
size = 1;
colorBackground[] = {0, 0, 0, 0};//0.5
colorText[] = {0, 0, 0, 0};
x = "safezoneX";
y = "safezoneY";
w = "safezoneW";
h = "safezoneH";
};
};
};

View File

@ -6,6 +6,7 @@ PREP(addActionEventHandler);
PREP(addActionMenuEventHandler);
PREP(addCameraEventHandler);
PREP(addCustomEventHandler);
PREP(addLineToDebugDraw);
PREP(addMapMarkerCreatedEventHandler);
PREP(addScrollWheelEventHandler);
PREP(adminKick);
@ -24,6 +25,7 @@ PREP(closeDialogIfTargetMoves);
PREP(codeToLetter);
PREP(codeToString);
PREP(convertKeyCode);
PREP(createOrthonormalReference);
PREP(currentChannel);
PREP(disableUserInput);
PREP(displayText);

View File

@ -0,0 +1,48 @@
/*
* Author: CAA-Picard
*
* Add line to draw on debug
*
* Argument:
* 0: Start point ASL (Array)
* 1: End point ASL (Array)
* 2: Color (Array)
*
* Return value:
*
*/
#include "script_component.hpp"
if (isNil QGVAR(debugLines)) then {
GVAR(debugLines) = [];
GVAR(debugLinesIndex) = 0;
};
if (count GVAR(debugLines) < 100) then {
GVAR(debugLines) pushBack _this;
GVAR(debugLinesIndex) = 0;
} else {
GVAR(debugLines) set [GVAR(debugLinesIndex), _this];
GVAR(debugLinesIndex) = (GVAR(debugLinesIndex) + 1) mod 100;
};
if (isNil QGVAR(debugDrawHandler)) then {
GVAR(debugDrawHandler) = addMissionEventHandler ["Draw3D", {
if (count GVAR(debugLines) == 0) exitWith {
removeMissionEventHandler ["Draw3D", GVAR(debugDrawHandler)];
GVAR(debugDrawHandler) = nil;
};
{
_p0 = _x select 0;
if (!surfaceIsWater _p0) then {
_p0 = ASLtoATL _p0;
};
_p1 = _x select 1;
if (!surfaceIsWater _p1) then {
_p1 = ASLtoATL _p1;
};
drawLine3D [_p0, _p1, _x select 2];
} forEach GVAR(debugLines);
}];
};

View File

@ -0,0 +1,21 @@
/*
* Author: CAA-Picard
*
* Returns a orthonormal system of reference aligned with the supplied vector
*
* Argument:
* Vector to align the coordinate system with (Array)
*
* Return value:
* 0: v1 (Array)
* 1: v2 (Array)
* 2: v3 (Array)
*/
#include "script_component.hpp"
private ["_v1","_v2","_v3"];
_v1 = vectorNormalized _this;
_v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]);
_v3 = _v2 vectorCrossProduct _v1;
[_v1,_v2,_v3]

View File

@ -1,61 +1,87 @@
/*
* Author: commy2
*
* Draw progress bar and execute given function if succesful.
*
* Argument:
* 0: Duration of the action (Number)
* 1: Arguments of the callback function (Array)
* 2: Callback function name (String)
* 3: Title of the loading bar (String)
* 4: Name of the function that is called when the action is aborted via ESC (String, optional)
*
* Return value:
* Nothing
*/
* Author: commy2, Glowbal, PabstMirror
*
* Draw progress bar and execute given function if succesful.
* Finish/Failure/Conditional are all passed [_args, _elapsedTime, _totalTime, _errorCode]
*
* Argument:
* 0: NUMBER - Total Time (in game "time" seconds)
* 1: ARRAY - Arguments, passed to condition, fail and finish
* 2: CODE or STRING - On Finish: Code called or STRING raised as event.
* 3: CODE or STRING - On Failure: Code called or STRING raised as event.
* 4: STRING - (Optional) Localized Title
* 5: CODE - (Optional) Code to check each frame
* 6: ARRAY - (Optional) Exceptions for checking EGVAR(common,canInteract)
*
* Return value:
* Nothing
*/
#include "script_component.hpp"
PARAMS_4(_totalTime,_args,_onFinish,_onFail);
DEFAULT_PARAM(4,_localizedTitle,"");
DEFAULT_PARAM(5,_condition,{true});
DEFAULT_PARAM(6,_exceptions,[]);
private ["_player", "_perFrameFunction"];
_player = ACE_player;
//Open Dialog and set the title
closeDialog 0;
createDialog QGVAR(ProgressBar_Dialog);
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText _localizedTitle;
_this spawn {
_time = _this select 0;
_arguments = _this select 1;
_function = call compile (_this select 2);
_title = _this select 3;
_function2 = call compile (_this select 4);
disableSerialization;
_ctrlProgressBar = uiNamespace getVariable QGVAR(ctrlProgressBar);
_ctrlProgressBarTitle = uiNamespace getVariable QGVAR(ctrlProgressBarTitle);
_ctrlProgressBar ctrlSetPosition [
safezoneX + 0.1 * safezoneW,
safezoneY + 0.2 * safezoneH,
0.8 * safezoneW,
0.01 * safezoneH
];
_ctrlProgressBar ctrlCommit (_time / accTime);
_ctrlProgressBarTitle ctrlSetText _title;
//_ctrlProgressBarTitle ctrlSetStructuredText _title;
_time = time + _time;
waitUntil {
//make sure the progressBar is still open, not just any dialog
(isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) || {!alive ACE_player} || {time > _time}
};
closeDialog 0;
_progress = 1;
if (time > _time) then {
_arguments call _function;
_perFrameFunction = {
PARAMS_2(_parameters,_pfhID);
EXPLODE_8_PVT(_parameters,_args,_onFinish,_onFail,_condition,_player,_startTime,_totalTime,_exceptions);
private ["_elapsedTime", "_errorCode"];
_elapsedTime = time - _startTime;
_errorCode = -1;
if (isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then {
_errorCode = 1;
} else {
[localize QUOTE(DOUBLES(STR,GVAR(ActionAborted)))] call FUNC(displayTextStructured);
if (!isNil "_function2") then {
_progress = 1 - ((_time - time) / (_this select 0)) max 0 min 1;
_arguments call _function2;
if (ACE_player != _player) then {
_errorCode = 2;
} else {
if (!([_args, _elapsedTime, _totalTime, _errorCode] call _condition)) then {
_errorCode = 3;
} else {
if (!(_exceptions call EGVAR(common,canInteract))) then {
_errorCode = 4;
} else {
if (_elapsedTime >= _totalTime) then {
_errorCode = 0;
};
};
};
};
};
if (_errorCode != -1) then {
//Error or Success, close dialog and remove PFEH
closeDialog 0;
[_pfhID] call CBA_fnc_removePerFrameHandler;
if (_errorCode == 0) then {
if ((typeName _onFinish) == (typeName "")) then {
[_onFinish, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent);
} else {
[_args, _elapsedTime, _totalTime, _errorCode] call _onFinish;
};
} else {
if ((typeName _onFail) == (typeName "")) then {
[_onFail, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent);
} else {
[_args, _elapsedTime, _totalTime, _errorCode] call _onFail;
};
};
} else {
//Update Progress Bar (ratio of elepased:total)
(uiNamespace getVariable QGVAR(ctrlProgressBar)) progressSetPosition (_elapsedTime / _totalTime);
};
};
[_perFrameFunction, 0, [_args, _onFinish, _onFail, _condition, _player, time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler;

View File

@ -56,13 +56,10 @@ if (ACE_player != _unit) then {
};
} else {
_unit playActionNow _actionToPlay;
if (GVAR(RequireSpecialist)) then {
if ([_unit] call EFUNC(Common,isEOD)) then {
[[true, _target] call _fnc_DefuseTime, [_unit,_target],
QFUNC(defuseExplosive), localize "STR_ACE_Explosives_DefusingExplosive"] call EFUNC(common,progressBar);
};
} else {
[[([_unit] call EFUNC(Common,isEOD)), _target] call _fnc_DefuseTime, [_unit,_target],
QFUNC(defuseExplosive), localize "STR_ACE_Explosives_DefusingExplosive"] call EFUNC(common,progressBar);
private ["_defuseSeconds", "_isEOD"];
_isEOD = [_unit] call EFUNC(Common,isEOD);
_defuseSeconds = [_isEOD, _target] call _fnc_DefuseTime;
if (_isEOD || {!GVAR(RequireSpecialist)}) then {
[_defuseSeconds, [_unit,_target], {(_this select 0) call FUNC(defuseExplosive)}, {}, (localize "STR_ACE_Explosives_DefusingExplosive")] call EFUNC(common,progressBar);
};
};

View File

@ -1,19 +1,19 @@
class CfgVehicles {
class Man;
class CAManBase: Man {
AGM_GForceCoef = 1;
ACE_GForceCoef = 1;
};
class B_Soldier_05_f;
class B_Pilot_F: B_Soldier_05_f {
AGM_GForceCoef = 0.55;
ACE_GForceCoef = 0.55;
};
class I_Soldier_04_F;
class I_pilot_F: I_Soldier_04_F {
AGM_GForceCoef = 0.55;
ACE_GForceCoef = 0.55;
};
class O_helipilot_F;
class O_Pilot_F: O_helipilot_F {
AGM_GForceCoef = 0.55;
ACE_GForceCoef = 0.55;
};
};

View File

@ -1,16 +1,16 @@
class CfgWeapons {
class ItemCore;
class Uniform_Base: ItemCore {
AGM_GForceCoef = 1;
ACE_GForceCoef = 1;
};
class U_B_PilotCoveralls: Uniform_Base {
AGM_GForceCoef = 0.8;
ACE_GForceCoef = 0.8;
};
class U_I_pilotCoveralls: Uniform_Base {
AGM_GForceCoef = 0.8;
ACE_GForceCoef = 0.8;
};
class U_O_PilotCoveralls: Uniform_Base {
AGM_GForceCoef = 0.8;
ACE_GForceCoef = 0.8;
};
};

View File

@ -59,8 +59,8 @@ if (count GVAR(GForces) > 0) then {
};
_classCoef = ACE_player getVariable ["ACE_GForceCoef",
getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "AGM_GForceCoef")];
_suitCoef = getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "AGM_GForceCoef");
getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "ACE_GForceCoef")];
_suitCoef = getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef");
_gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG;
_gRedOut = MINVIRTUALG / _classCoef;

View File

@ -30,7 +30,7 @@ for "_index" from 0 to (_count - 1) do {
call EFUNC(interaction,hideMenu);
if (isNil "_data") exitWith {};
_data set [2, [_data select 2] call EFUNC(common,toNumber)];
[_data select 2, _data, QFUNC(magazineRepackCallback), localize "STR_ACE_MagazineRepack_RepackingMagazine"] call EFUNC(common,progressBar);
[(_data select 2), _data, {(_this select 0) call FUNC(magazineRepackCallback)}, {}, (localize "STR_ACE_MagazineRepack_RepackingMagazine")] call EFUNC(common,progressBar);
[ACE_player] call EFUNC(common,goKneeling);
},
{

View File

@ -21,4 +21,4 @@ _player playActionNow "GestureDismountMuzzle";
_player playAction "GestureMountMuzzle";
playSound "ACE_BarrelSwap";
[10, [_player, _weapon], QFUNC(swapBarrelCallback), localize "STR_ACE_Overheating_SwappingBarrel"] call EFUNC(common,progressBar);
[10, [_player, _weapon], {(_this select 0) call FUNC(swapBarrelCallback)}, {}, (localize "STR_ACE_Overheating_SwappingBarrel")] call EFUNC(common,progressBar);

View File

@ -0,0 +1 @@
z\ace\addons\vehiclelock

View File

@ -0,0 +1,5 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};

View 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;
};
};

View 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"};
};
};
};

View 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));
};
};

View 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);

View File

@ -0,0 +1,22 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common", "ace_interaction"};
author[] = {"PabstMirror"};
authorUrl = "https://github.com/PabstMirror/";
VERSION_CONFIG;
};
};
class ACE_Parameters_Numeric {
GVAR(DefaultLockpickStrength) = 10;
};
#include "CfgEventHandlers.hpp"
#include "CfgMagazines.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

View 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;
};

View 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(lockSide), _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

View 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

View File

@ -0,0 +1,79 @@
/*
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", "_condition"];
_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"): {
_condition = {
PARAMS_1(_args);
EXPLODE_2_PVT(_args,_unit,_veh);
([_unit] call EFUNC(common,canInteract)) && ((_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);
};
case (_funcType == "finishLockpick"): {
["SetVehicleLock", [_veh], [_veh, false]] call EFUNC(common,targetEvent);
};
default {
["ACE_VehicleLock_fnc_lockpick: bad function type"] call BIS_fnc_error;
};
};
_returnValue;

View 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;
};

View 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);

View 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];

View 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

View File

@ -0,0 +1 @@
#include "\z\ace\addons\vehiclelock\script_component.hpp"

View File

@ -0,0 +1,44 @@
ace_vehiclelock
===============
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 (e.g.: 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:
`ACE_key_customKeyMagazine` (should never be manualy added, needs to be 'programed' to work on a vehicle)
## 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_VehicleLock_lockSide` - SIDE: overrides a vehicle's side, allows indfor to use little-bird's with indp keys
* `ACE_vehicleLock_lockpickStrength` - NUMBER: secons, determines how long lockpicking with take, overrides ACE_VehicleLock_DefaultLockpickStrength
* `ACE_VehicleLock_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
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [PabstMirror](https://github.com/PabstMirror)

View 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"

View File

@ -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>