From 5dc94487c5c4a1819466e23555050d11daed336d Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 2 Jun 2015 20:50:27 -0500 Subject: [PATCH] Module Settings for Captivity Setting for handcuffing own team, and allowing surrender. --- addons/captives/ACE_Settings.hpp | 14 +++++++++ addons/captives/CfgVehicles.hpp | 31 ++++++++++++++++++- addons/captives/XEH_preInit.sqf | 1 + addons/captives/config.cpp | 3 +- .../functions/fnc_canApplyHandcuffs.sqf | 3 +- .../captives/functions/fnc_canSurrender.sqf | 2 +- .../captives/functions/fnc_moduleSettings.sqf | 19 ++++++++++++ addons/captives/stringtable.xml | 18 +++++++++++ 8 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 addons/captives/ACE_Settings.hpp create mode 100644 addons/captives/functions/fnc_moduleSettings.sqf diff --git a/addons/captives/ACE_Settings.hpp b/addons/captives/ACE_Settings.hpp new file mode 100644 index 0000000000..252fbc551d --- /dev/null +++ b/addons/captives/ACE_Settings.hpp @@ -0,0 +1,14 @@ +class ACE_Settings { + class GVAR(allowHandcuffOwnSide) { + displayName = "$STR_ACE_Captives_ModuleSettings_handcuffSide_name"; + description = "$STR_ACE_Captives_ModuleSettings_handcuffSide_description"; + typeName = "BOOL"; + value = 1; + }; + class GVAR(allowSurrender) { + displayName = "$STR_ACE_Captives_ModuleSettings_allowSurrender_name"; + description = "$STR_ACE_Captives_ModuleSettings_allowSurrender_description"; + typeName = "BOOL"; + value = 1; + }; +}; diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index ec142a533b..1c01a3b428 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -162,7 +162,7 @@ class CfgVehicles { author = "$STR_ACE_Common_ACETeam"; category = "ACE"; displayName = "$STR_ACE_Captives_ModuleSurrender_DisplayName"; //Make Unit Surrender - function = QUOTE(DFUNC(moduleSurrender)); + function = QFUNC(moduleSurrender); scope = 2; //show in editor isGlobal = 1; //run global isTriggerActivated = 1; //Wait for triggers @@ -174,4 +174,33 @@ class CfgVehicles { sync[] = {"AnyAI"}; }; }; + + class ACE_Module: Module_F {}; + class GVAR(moduleSettings): ACE_Module { + author = "$STR_ACE_Common_ACETeam"; + category = "ACE"; + displayName = "$STR_ACE_Captives_ModuleSettings_DisplayName"; + function = QFUNC(moduleSettings); + scope = 2; + icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Surrender_ca.paa)); + isGlobal = 1; + class Arguments { + class allowHandcuffOwnSide { + displayName = "$STR_ACE_Captives_ModuleSettings_handcuffSide_name"; + description = "$STR_ACE_Captives_ModuleSettings_handcuffSide_description"; + typeName = "BOOL"; + defaultValue = 1; + }; + class allowSurrender { + displayName = "$STR_ACE_Captives_ModuleSettings_allowSurrender_name"; + description = "$STR_ACE_Captives_ModuleSettings_allowSurrender_description"; + typeName = "BOOL"; + defaultValue = 1; + }; + }; + class ModuleDescription: ModuleDescription { + description = "$STR_ACE_Captives_ModuleSettings_Description"; + sync[] = {}; + }; + }; }; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index bc6a61bc4f..31bcbe8e02 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -24,6 +24,7 @@ PREP(handlePlayerChanged); PREP(handleRespawn); PREP(handleUnitInitPost); PREP(handleZeusDisplayChanged); +PREP(moduleSettings); PREP(moduleSurrender); PREP(setHandcuffed); PREP(setSurrendered); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index 57de6ee970..cdaf6dc4e4 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -2,7 +2,7 @@ class CfgPatches { class ADDON { - units[] = {QGVAR(ModuleSurrender)}; + units[] = {QGVAR(ModuleSettings), QGVAR(ModuleSurrender)}; weapons[] = {"ACE_CableTie"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ACE_Interaction"}; @@ -12,6 +12,7 @@ class CfgPatches { }; }; +#include "ACE_Settings.hpp" #include "CfgEventHandlers.hpp" #include "CfgMoves.hpp" #include "CfgVehicles.hpp" diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf index f69bb2544d..e42b5455ff 100644 --- a/addons/captives/functions/fnc_canApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -18,8 +18,9 @@ PARAMS_2(_unit,_target); -//Player has cableTie, target is alive and not already handcuffed +//Check sides, Player has cableTie, target is alive and not already handcuffed +(GVAR(allowHandcuffOwnSide) || {(side _unit) != (side _target)}) && ("ACE_CableTie" in (items _unit)) && {alive _target} && {!(_target getVariable [QGVAR(isHandcuffed), false])} diff --git a/addons/captives/functions/fnc_canSurrender.sqf b/addons/captives/functions/fnc_canSurrender.sqf index 9ba7cf6de0..059fb98d03 100644 --- a/addons/captives/functions/fnc_canSurrender.sqf +++ b/addons/captives/functions/fnc_canSurrender.sqf @@ -22,7 +22,7 @@ private "_returnValue"; _returnValue = if (_newSurrenderState) then { //no weapon equiped AND not currently surrendering and - (currentWeapon _unit == "") && {!(_unit getVariable [QGVAR(isSurrendering), false])} + GVAR(allowSurrender) && {(currentWeapon _unit) == ""} && {!(_unit getVariable [QGVAR(isSurrendering), false])} } else { //is Surrendering (_unit getVariable [QGVAR(isSurrendering), false]) diff --git a/addons/captives/functions/fnc_moduleSettings.sqf b/addons/captives/functions/fnc_moduleSettings.sqf new file mode 100644 index 0000000000..c12ac80b99 --- /dev/null +++ b/addons/captives/functions/fnc_moduleSettings.sqf @@ -0,0 +1,19 @@ +/* + * Author: PabstMirror + * Module for captivity settings + * + * Arguments: + * 0: The module logic + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +PARAMS_1(_logic); + +[_logic, QGVAR(allowHandcuffOwnSide), "allowHandcuffOwnSide"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(allowSurrender), "allowSurrender"] call EFUNC(common,readSettingFromModule); diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 4e329675d1..8d8c30e92c 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -169,5 +169,23 @@ Sincroniza una unidad para hacer que se rinda.<br />Fuente: ace_captives Einheit synchronisieren, um sie kapitulieren zu lassen.<br />Quelle: ace_captives + + Captives Settings + + + Controls settings for surrender and cable ties + + + Can handcuff own side + + + Can players cabletie units on their own side + + + Allow surrendering + + + Players can surrender after holstering their weapon +