diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index afda86cfda..eff1cf4c52 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -153,16 +153,32 @@ class CfgVehicles { class GVAR(ModuleSurrender): Module_F { author = ECSTRING(common,ACETeam); category = "ACE"; - displayName = CSTRING(ModuleSurrender_DisplayName); //Make Unit Surrender + displayName = CSTRING(ModuleSurrender_DisplayName); function = QFUNC(moduleSurrender); scope = 2; //show in editor - isGlobal = 1; //run global + isGlobal = 0; //run on server isTriggerActivated = 1; //Wait for triggers icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Surrender_ca.paa)); functionPriority = 0; class Arguments {}; class ModuleDescription: ModuleDescription { - description = CSTRING(ModuleSurrender_Description); //Sync a unit to make them surrender.
Source: ace_captives + description = CSTRING(ModuleSurrender_Description); + sync[] = {"AnyAI"}; + }; + }; + class GVAR(ModuleHandcuffed): Module_F { + author = ECSTRING(common,ACETeam); + category = "ACE"; + displayName = CSTRING(ModuleHandcuffed_DisplayName); + function = QFUNC(moduleHandcuffed); + scope = 2; //show in editor + isGlobal = 0; //run on server + isTriggerActivated = 1; //Wait for triggers + icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Handcuffed_ca.paa)); + functionPriority = 0; + class Arguments {}; + class ModuleDescription: ModuleDescription { + description = CSTRING(ModuleHandcuffed_Description); sync[] = {"AnyAI"}; }; }; diff --git a/addons/captives/UI/Icon_Module_Make_Unit_Handcuffed_ca.paa b/addons/captives/UI/Icon_Module_Make_Unit_Handcuffed_ca.paa new file mode 100644 index 0000000000..85c556cb2a Binary files /dev/null and b/addons/captives/UI/Icon_Module_Make_Unit_Handcuffed_ca.paa differ diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index b59249b937..dcc585ef8e 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(moduleHandcuffed); PREP(moduleSettings); PREP(moduleSurrender); PREP(setHandcuffed); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index cdaf6dc4e4..a9ec2950ee 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -2,7 +2,7 @@ class CfgPatches { class ADDON { - units[] = {QGVAR(ModuleSettings), QGVAR(ModuleSurrender)}; + units[] = {QGVAR(ModuleSettings), QGVAR(ModuleSurrender), QGVAR(ModuleHandcuffed)}; weapons[] = {"ACE_CableTie"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ACE_Interaction"}; diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf index 368ce3cb7a..f5fa666652 100644 --- a/addons/captives/functions/fnc_canApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -20,11 +20,12 @@ params ["_unit", "_target"]; //Check sides, Player has cableTie, target is alive and not already handcuffed (GVAR(allowHandcuffOwnSide) || {(side _unit) != (side _target)}) && -("ACE_CableTie" in (items _unit)) && +{"ACE_CableTie" in (items _unit)} && {alive _target} && {!(_target getVariable [QGVAR(isHandcuffed), false])} && { (_target getVariable ["ACE_isUnconscious", false]) || //isUnconscious + {!([_target] call EFUNC(common,isPlayer))} || //is an AI (not a player) {GVAR(requireSurrender) == 0} || //or don't require surrendering {_target getVariable [QGVAR(isSurrendering), false]} || //or is surrendering {(GVAR(requireSurrender) == 2) && {(currentWeapon _target) == ""}} //or "SurrenderOrNoWeapon" and no weapon diff --git a/addons/captives/functions/fnc_moduleHandcuffed.sqf b/addons/captives/functions/fnc_moduleHandcuffed.sqf new file mode 100644 index 0000000000..4c6cc4c6fc --- /dev/null +++ b/addons/captives/functions/fnc_moduleHandcuffed.sqf @@ -0,0 +1,35 @@ +/* + * Author: PabstMirror + * Module Function to make a unit handcuffed (can be called from editor) + * + * Arguments: + * 0: The Module Logic + * 1: synced objects + * 2: Activated + * + * Return Value: + * Nothing + * + * Example: + * Called from module + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; + +TRACE_3("params",_logic,_units,_activated); + +if (!_activated) exitWith {}; +if (!isServer) exitWith {}; + +//Modules run before postInit can instal the event handler, so we need to wait a little bit +[{ + params ["_units"]; + { + ["SetHandcuffed", [_x], [_x, true]] call EFUNC(common,targetEvent); + } forEach _units; +}, [_units], 0.05] call EFUNC(common,waitAndExecute); + +deleteVehicle _logic; diff --git a/addons/captives/functions/fnc_moduleSurrender.sqf b/addons/captives/functions/fnc_moduleSurrender.sqf index bdb0f7c1b5..f5c091a78a 100644 --- a/addons/captives/functions/fnc_moduleSurrender.sqf +++ b/addons/captives/functions/fnc_moduleSurrender.sqf @@ -1,9 +1,9 @@ /* * Author: PabstMirror - * Module Function to make a unit surrender (can be called from editor, or placed with zeus) + * Module Function to make a unit surrender (can be called from editor) * * Arguments: - * 0: The Module Logic Object + * 0: The Module Logic * 1: synced objects * 2: Activated * @@ -17,20 +17,19 @@ */ #include "script_component.hpp" -private ["_bisMouseOver", "_mouseOverObject"]; - params ["_logic", "_units", "_activated"]; +TRACE_3("params",_logic,_units,_activated); + if (!_activated) exitWith {}; +if (!isServer) exitWith {}; -if (local _logic) then { - //Modules run before postInit can instal the event handler, so we need to wait a little bit - [{ - params ["_units"]; - { - ["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent); - } forEach _units; - }, [_units], 0.05]call EFUNC(common,waitAndExecute); +//Modules run before postInit can instal the event handler, so we need to wait a little bit +[{ + params ["_units"]; + { + ["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent); + } forEach _units; +}, [_units], 0.05] call EFUNC(common,waitAndExecute); - deleteVehicle _logic; -}; +deleteVehicle _logic; diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 0ab6cb457d..d4166a495d 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -179,6 +179,12 @@ Egység szinkronizálása, hogy kapituláljon.<br />Forrás: ace_captives Синхронизируйте с юнитами, чтобы сделать их пленными.<br />Источник: ace_captives + + Make Unit Handcuffed + + + Sync a unit to make them handcuffed.<br />Source: ace_captives + Captives Settings Ustawienia więźniów diff --git a/extras/assets/icons/Icon_Module_png/Icon_Module_Make_Unit_Handcuffed_ca.png b/extras/assets/icons/Icon_Module_png/Icon_Module_Make_Unit_Handcuffed_ca.png new file mode 100644 index 0000000000..e097b6ac7f Binary files /dev/null and b/extras/assets/icons/Icon_Module_png/Icon_Module_Make_Unit_Handcuffed_ca.png differ