From 1c26f6c9f5e7093c335f362ddaece8521bb6176d Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 23 Oct 2015 14:17:31 -0500 Subject: [PATCH] Captives - Module to set handcuffing also add player check for GVAR(requireSurrender) in canApplyHandcuffes --- addons/captives/CfgVehicles.hpp | 22 +++++++++-- .../Icon_Module_Make_Unit_Handcuffed_ca.paa | Bin 0 -> 5625 bytes addons/captives/XEH_preInit.sqf | 1 + addons/captives/config.cpp | 2 +- .../functions/fnc_canApplyHandcuffs.sqf | 3 +- .../functions/fnc_moduleHandcuffed.sqf | 35 ++++++++++++++++++ .../functions/fnc_moduleSurrender.sqf | 27 +++++++------- addons/captives/stringtable.xml | 6 +++ .../Icon_Module_Make_Unit_Handcuffed_ca.png | Bin 0 -> 1293 bytes 9 files changed, 77 insertions(+), 19 deletions(-) create mode 100644 addons/captives/UI/Icon_Module_Make_Unit_Handcuffed_ca.paa create mode 100644 addons/captives/functions/fnc_moduleHandcuffed.sqf create mode 100644 extras/assets/icons/Icon_Module_png/Icon_Module_Make_Unit_Handcuffed_ca.png 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 0000000000000000000000000000000000000000..85c556cb2ac7c456f369905b44e34450aae5d2b5 GIT binary patch literal 5625 zcmd^@drVVT7{Cvuh`8|3I8b>y9_qxA5yxJ*Ufc$B6RVps#JB}23#hB8+5R%K7g!|z zfm9aElA+z)vWIS?FumC$hEB}_Lcq99!Lp5PfCL#2d1#^K?3`P^)7#s?-6BNeZd$^x z-*>*(`OdlbTtA$Vk+$XejIC*EgwXi-_%4yN)3PXIa#7Am+mKG#hkPl&nx3xX$p1X~ zmWCj7WHCaO4&vN|4 z93PiiEb)g-aoP$GR%=b_>HI6^PZT`!@wV^jkE`%xS^fyAV#o*Lk^5I-ulYuqDmn)2 zVWgF_Xp+fg^_Tnew(mKga(yMn^7(fSVEMbkF-hl(Xw1N}_~(B9N&X}vRzF0VONnRd zf7kqb+9OluVSh%Z1(eo@G=HYM->H;d5_=}n|I^mjr7hK`zf7;MJYTe5-0@7!|Fr&< z?aAXI^`Egm54v1lkN+3bZ0QC4?V`EkgsXz#KuYl__}kW3@T+FwwgbQm`z%@3LVG80 z)G5JWvqZK6&vksWZoeFX-6 z6>NR`^!%PQdhtXN$dlTG9btHaqS!B)zmWaIcZBW#i#|&~GHDmZqI~t=MrTt}#I*I2 z*Ke*lr$^9-laL|)rv~sJj_e(b&)pyrt-GIN{|q*rFLCRy9B~AvNY=+?TFJ~jHa@W( z4{wQlld&qVhOB@0_`A)|>wF?s+1;-Xx;zHOknJ1sb)@XZ!3*TCSOAfcJ{(wn3`gRE zAC3mO$dbos#QPuY@CoYhkOvR4ZAx@P?qne6>x_e*{?RQwgMTuf9(yJBydKlZF@>m{)vF|PS^zV|p+fIoe z!P;7bkXr)vn|B%ODh_kc0Y5|Y69U+NI;d<`K1~Btr`;c+)Sz61N_q1nJin8b1!gWS9kuw`pSQOnt<@LnP?(T}$27O`c;S&Mv-R?pgwv+h$7X4?p7J*-CBE9~yYS;?Lu z(U(udlG7>r6+ItVz~8#wxYR3#?Qa9i^~E$L+fYP9Y50)>@vtS9X>(KZvbTE0o3Y4p z{rPAa7`z5IXEUlbsA-_7MCLZLCX#dIh*HlM=)nrE{_2j;8 OIAw?`3x%Iu(f$Lt=QtYx literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..e097b6ac7f18eddd66983254e17c060297251d7f GIT binary patch literal 1293 zcmV+o1@iidP)&abeVz~4Haj`qMY#d?_sUO?DNexGv|!^JKs2S{;)Xvvi3e}|G%}@ zxAs1#PLha=x4zgcP?Fid+j@_=!HJhwol1v>i}bop+KfXq;B0_OPVQH%gE0*YQR4|o83@&L<#cHoc9 zEUNPUUnA+bq$83xO4=pqf}{mtdx7V@?ObAfgMW4bFB6-Dj9q?;q@5ay6Oy(E zdb@+Z%LxgwO;TM<8?#P@Zvj>X^%KD7US1EhV2RNDK&J*4c}`Njq!&lg578lMMa&==YoghbzDhCp;xG%@A*sO^eoJ$%GN?IO^fLL2# zE0)5BxCDHL9cckp0LwAAe+i2Nn}8dGF}=VSz>i*E4BQDU40P@S9s+)%G^ZFFBCz;K z%2PTjsYTLE*J+frNYWNbtNiJIofy+0=^05=gSn?lx?j@1gzjnCk$PNgfu!pf7eAbS zgOd>Aj4yt;F}J0Va4-e|G4g=$xH^EH>b@C4|2&rXgwcEtuxo@doxqorrpblM%uGiN z0>Z@PckHM;5@rC4g8Be(xQy@l)uo8ES7gPAK|q+A_5=S!n6n&2$zo$nG7yxTD9!83 z#oRJ<<|pR9JcjQXf*1sZdHgJ3$te1#f$td1LL0GLp=8<{VmfdSrD=6nWoD)$1_Api zy}w_Fo#fK61Y2ka@NLjuz^=d3NSKcOV6rx7>jUkp9Z`M+>Bj# z{ORpWv2()r*!}+}*i$W{#Xs9!2kaL4Zb}yqcCpeH!S-mW@LEZI8j3zihh2&|Dd}<9 z#m2iSVpQZz6kUp)`B!2@{O9ch*!})q?8lEViZ8$xzZ%Od zZ}RqjjMM{IcG*c}O#1%`*8U`ww*h&hMnK*MF)dx+XVH00000NkvXXu0mjf DR3lt> literal 0 HcmV?d00001