From 38655980956b905f31efe7c0feee27b9d58323d1 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 2 Feb 2015 19:48:33 -0600 Subject: [PATCH 01/16] AGM_Captives --- .../captives}/UI/agm_cabletie_x_ca.paa | Bin .../Captives => addons/captives}/UI/captive_ca.paa | Bin .../Captives => addons/captives}/UI/handcuff_ca.paa | Bin .../Captives => addons/captives}/agm_cabletie.p3d | Bin .../agm/Captives => addons/captives}/clientInit.sqf | 0 .../agm/Captives => addons/captives}/config.cpp | 0 .../captives}/functions/fn_canFriskPerson.sqf | 0 .../captives}/functions/fn_canLoadCaptive.sqf | 0 .../captives}/functions/fn_canUnloadCaptive.sqf | 0 .../captives}/functions/fn_escortCaptive.sqf | 0 .../captives}/functions/fn_handleGetOut.sqf | 0 .../captives}/functions/fn_handleKnockedOut.sqf | 0 .../captives}/functions/fn_handlePlayerChanged.sqf | 0 .../captives}/functions/fn_handleWokeUp.sqf | 0 .../captives}/functions/fn_initPost.sqf | 0 .../captives}/functions/fn_initUnit.sqf | 0 .../captives}/functions/fn_loadCaptive.sqf | 0 .../captives}/functions/fn_openFriskMenu.sqf | 0 .../captives}/functions/fn_setCaptive.sqf | 0 .../captives}/functions/fn_surrender.sqf | 0 .../captives}/functions/fn_unloadCaptive.sqf | 0 .../Captives => addons/captives}/stringtable.xml | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename {TO_MERGE/agm/Captives => addons/captives}/UI/agm_cabletie_x_ca.paa (100%) rename {TO_MERGE/agm/Captives => addons/captives}/UI/captive_ca.paa (100%) rename {TO_MERGE/agm/Captives => addons/captives}/UI/handcuff_ca.paa (100%) rename {TO_MERGE/agm/Captives => addons/captives}/agm_cabletie.p3d (100%) rename {TO_MERGE/agm/Captives => addons/captives}/clientInit.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/config.cpp (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_canFriskPerson.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_canLoadCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_canUnloadCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_escortCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_handleGetOut.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_handleKnockedOut.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_handlePlayerChanged.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_handleWokeUp.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_initPost.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_initUnit.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_loadCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_openFriskMenu.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_setCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_surrender.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_unloadCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/stringtable.xml (100%) diff --git a/TO_MERGE/agm/Captives/UI/agm_cabletie_x_ca.paa b/addons/captives/UI/agm_cabletie_x_ca.paa similarity index 100% rename from TO_MERGE/agm/Captives/UI/agm_cabletie_x_ca.paa rename to addons/captives/UI/agm_cabletie_x_ca.paa diff --git a/TO_MERGE/agm/Captives/UI/captive_ca.paa b/addons/captives/UI/captive_ca.paa similarity index 100% rename from TO_MERGE/agm/Captives/UI/captive_ca.paa rename to addons/captives/UI/captive_ca.paa diff --git a/TO_MERGE/agm/Captives/UI/handcuff_ca.paa b/addons/captives/UI/handcuff_ca.paa similarity index 100% rename from TO_MERGE/agm/Captives/UI/handcuff_ca.paa rename to addons/captives/UI/handcuff_ca.paa diff --git a/TO_MERGE/agm/Captives/agm_cabletie.p3d b/addons/captives/agm_cabletie.p3d similarity index 100% rename from TO_MERGE/agm/Captives/agm_cabletie.p3d rename to addons/captives/agm_cabletie.p3d diff --git a/TO_MERGE/agm/Captives/clientInit.sqf b/addons/captives/clientInit.sqf similarity index 100% rename from TO_MERGE/agm/Captives/clientInit.sqf rename to addons/captives/clientInit.sqf diff --git a/TO_MERGE/agm/Captives/config.cpp b/addons/captives/config.cpp similarity index 100% rename from TO_MERGE/agm/Captives/config.cpp rename to addons/captives/config.cpp diff --git a/TO_MERGE/agm/Captives/functions/fn_canFriskPerson.sqf b/addons/captives/functions/fn_canFriskPerson.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_canFriskPerson.sqf rename to addons/captives/functions/fn_canFriskPerson.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_canLoadCaptive.sqf b/addons/captives/functions/fn_canLoadCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_canLoadCaptive.sqf rename to addons/captives/functions/fn_canLoadCaptive.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_canUnloadCaptive.sqf b/addons/captives/functions/fn_canUnloadCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_canUnloadCaptive.sqf rename to addons/captives/functions/fn_canUnloadCaptive.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_escortCaptive.sqf b/addons/captives/functions/fn_escortCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_escortCaptive.sqf rename to addons/captives/functions/fn_escortCaptive.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_handleGetOut.sqf b/addons/captives/functions/fn_handleGetOut.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_handleGetOut.sqf rename to addons/captives/functions/fn_handleGetOut.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_handleKnockedOut.sqf b/addons/captives/functions/fn_handleKnockedOut.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_handleKnockedOut.sqf rename to addons/captives/functions/fn_handleKnockedOut.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_handlePlayerChanged.sqf b/addons/captives/functions/fn_handlePlayerChanged.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_handlePlayerChanged.sqf rename to addons/captives/functions/fn_handlePlayerChanged.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_handleWokeUp.sqf b/addons/captives/functions/fn_handleWokeUp.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_handleWokeUp.sqf rename to addons/captives/functions/fn_handleWokeUp.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_initPost.sqf b/addons/captives/functions/fn_initPost.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_initPost.sqf rename to addons/captives/functions/fn_initPost.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_initUnit.sqf b/addons/captives/functions/fn_initUnit.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_initUnit.sqf rename to addons/captives/functions/fn_initUnit.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_loadCaptive.sqf b/addons/captives/functions/fn_loadCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_loadCaptive.sqf rename to addons/captives/functions/fn_loadCaptive.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_openFriskMenu.sqf b/addons/captives/functions/fn_openFriskMenu.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_openFriskMenu.sqf rename to addons/captives/functions/fn_openFriskMenu.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_setCaptive.sqf b/addons/captives/functions/fn_setCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_setCaptive.sqf rename to addons/captives/functions/fn_setCaptive.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_surrender.sqf b/addons/captives/functions/fn_surrender.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_surrender.sqf rename to addons/captives/functions/fn_surrender.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_unloadCaptive.sqf b/addons/captives/functions/fn_unloadCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_unloadCaptive.sqf rename to addons/captives/functions/fn_unloadCaptive.sqf diff --git a/TO_MERGE/agm/Captives/stringtable.xml b/addons/captives/stringtable.xml similarity index 100% rename from TO_MERGE/agm/Captives/stringtable.xml rename to addons/captives/stringtable.xml From 982f3b230ad0a2a9d1ccf6c6f3a7f798f87729c8 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 2 Feb 2015 20:04:50 -0600 Subject: [PATCH 02/16] Captives First Pass --- addons/captives/$PBOPREFIX$ | 1 + addons/captives/CfgEventHandlers.hpp | 57 +++ addons/captives/CfgMoves.hpp | 90 +++++ addons/captives/CfgVehicles.hpp | 157 ++++++++ addons/captives/CfgWeapons.hpp | 15 + ..._cabletie_x_ca.paa => ace_cabletie_ca.paa} | Bin addons/captives/XEH_postInitClient.sqf | 3 + addons/captives/XEH_preInit.sqf | 22 + addons/captives/agm_cabletie.p3d | Bin 49251 -> 0 bytes addons/captives/clientInit.sqf | 3 - addons/captives/config.cpp | 381 ++---------------- .../captives/functions/fn_canFriskPerson.sqf | 21 - .../captives/functions/fn_canLoadCaptive.sqf | 35 -- .../functions/fn_canUnloadCaptive.sqf | 23 -- .../captives/functions/fn_escortCaptive.sqf | 43 -- addons/captives/functions/fn_handleGetOut.sqf | 14 - .../functions/fn_handlePlayerChanged.sqf | 12 - addons/captives/functions/fn_handleWokeUp.sqf | 10 - addons/captives/functions/fn_initPost.sqf | 11 - addons/captives/functions/fn_initUnit.sqf | 12 - addons/captives/functions/fn_setCaptive.sqf | 57 --- .../captives/functions/fn_unloadCaptive.sqf | 31 -- .../captives/functions/fnc_canFriskPerson.sqf | 23 ++ .../captives/functions/fnc_canLoadCaptive.sqf | 38 ++ .../functions/fnc_canUnloadCaptive.sqf | 28 ++ .../captives/functions/fnc_escortCaptive.sqf | 55 +++ .../captives/functions/fnc_handleGetOut.sqf | 29 ++ ...nockedOut.sqf => fnc_handleKnockedOut.sqf} | 0 .../functions/fnc_handlePlayerChanged.sqf | 25 ++ .../captives/functions/fnc_handleWokeUp.sqf | 23 ++ addons/captives/functions/fnc_initPost.sqf | 24 ++ addons/captives/functions/fnc_initUnit.sqf | 29 ++ ...fn_loadCaptive.sqf => fnc_loadCaptive.sqf} | 33 +- ...penFriskMenu.sqf => fnc_openFriskMenu.sqf} | 44 +- addons/captives/functions/fnc_setCaptive.sqf | 59 +++ .../{fn_surrender.sqf => fnc_surrender.sqf} | 43 +- .../captives/functions/fnc_unloadCaptive.sqf | 35 ++ .../captives/functions/script_component.hpp | 1 + addons/captives/models/ace_cabletie.p3d | Bin 0 -> 52371 bytes addons/captives/models/ace_default.rvmat | 79 ++++ addons/captives/script_component.hpp | 12 + addons/captives/stringtable.xml | 24 +- 42 files changed, 907 insertions(+), 695 deletions(-) create mode 100644 addons/captives/$PBOPREFIX$ create mode 100644 addons/captives/CfgEventHandlers.hpp create mode 100644 addons/captives/CfgMoves.hpp create mode 100644 addons/captives/CfgVehicles.hpp create mode 100644 addons/captives/CfgWeapons.hpp rename addons/captives/UI/{agm_cabletie_x_ca.paa => ace_cabletie_ca.paa} (100%) create mode 100644 addons/captives/XEH_postInitClient.sqf create mode 100644 addons/captives/XEH_preInit.sqf delete mode 100644 addons/captives/agm_cabletie.p3d delete mode 100644 addons/captives/clientInit.sqf delete mode 100644 addons/captives/functions/fn_canFriskPerson.sqf delete mode 100644 addons/captives/functions/fn_canLoadCaptive.sqf delete mode 100644 addons/captives/functions/fn_canUnloadCaptive.sqf delete mode 100644 addons/captives/functions/fn_escortCaptive.sqf delete mode 100644 addons/captives/functions/fn_handleGetOut.sqf delete mode 100644 addons/captives/functions/fn_handlePlayerChanged.sqf delete mode 100644 addons/captives/functions/fn_handleWokeUp.sqf delete mode 100644 addons/captives/functions/fn_initPost.sqf delete mode 100644 addons/captives/functions/fn_initUnit.sqf delete mode 100644 addons/captives/functions/fn_setCaptive.sqf delete mode 100644 addons/captives/functions/fn_unloadCaptive.sqf create mode 100644 addons/captives/functions/fnc_canFriskPerson.sqf create mode 100644 addons/captives/functions/fnc_canLoadCaptive.sqf create mode 100644 addons/captives/functions/fnc_canUnloadCaptive.sqf create mode 100644 addons/captives/functions/fnc_escortCaptive.sqf create mode 100644 addons/captives/functions/fnc_handleGetOut.sqf rename addons/captives/functions/{fn_handleKnockedOut.sqf => fnc_handleKnockedOut.sqf} (100%) create mode 100644 addons/captives/functions/fnc_handlePlayerChanged.sqf create mode 100644 addons/captives/functions/fnc_handleWokeUp.sqf create mode 100644 addons/captives/functions/fnc_initPost.sqf create mode 100644 addons/captives/functions/fnc_initUnit.sqf rename addons/captives/functions/{fn_loadCaptive.sqf => fnc_loadCaptive.sqf} (52%) rename addons/captives/functions/{fn_openFriskMenu.sqf => fnc_openFriskMenu.sqf} (54%) create mode 100644 addons/captives/functions/fnc_setCaptive.sqf rename addons/captives/functions/{fn_surrender.sqf => fnc_surrender.sqf} (53%) create mode 100644 addons/captives/functions/fnc_unloadCaptive.sqf create mode 100644 addons/captives/functions/script_component.hpp create mode 100644 addons/captives/models/ace_cabletie.p3d create mode 100644 addons/captives/models/ace_default.rvmat create mode 100644 addons/captives/script_component.hpp diff --git a/addons/captives/$PBOPREFIX$ b/addons/captives/$PBOPREFIX$ new file mode 100644 index 0000000000..aac16576c4 --- /dev/null +++ b/addons/captives/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\captives \ No newline at end of file diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp new file mode 100644 index 0000000000..eb08f7e865 --- /dev/null +++ b/addons/captives/CfgEventHandlers.hpp @@ -0,0 +1,57 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient)); + }; +}; + +//release escorted captive when entering a vehicle +class Extended_GetIn_EventHandlers { + class All { + class GVAR(AutoDetachCaptive) { + getIn = "if (local (_this select 2) && {(_this select 2) getVariable ['ACE_isEscorting', false]}) then {(_this select 2) setVariable ['ACE_isEscorting', false, true]}"; + }; + }; +}; + +//reset captive animation after leaving vehicle +class Extended_GetOut_EventHandlers { + class All { + class GVAR(AutoDetachCaptive) { + getOut = "if (local (_this select 2) && {(_this select 2) getVariable ['ACE_isCaptive', false]}) then {_this call ACE_Captives_fnc_handleGetOut}"; + }; + }; +}; + +//reset captivity and escorting status when getting killed +class Extended_Killed_EventHandlers { + class CAManBase { + class GVAR(AutoDetachCaptive) { + killed = "if ((_this select 0) getVariable ['ACE_isCaptive', false]) then {(_this select 0) setVariable ['ACE_isCaptive', false, true]}; if ((_this select 0) getVariable ['ACE_isEscorting', false]) then {(_this select 0) setVariable ['ACE_isEscorting', false, true]};"; + }; + }; +}; + +//handle captive and unconsciousness state +class Extended_Init_EventHandlers { + class CAManBase { + class GVAR(AutoDetachCaptive) { + init = "_this call ACE_Captives_fnc_initUnit"; + }; + }; +}; + +//mission start +class Extended_InitPost_EventHandlers { + class CAManBase { + class GVAR(InitPost) { + init = "if (local (_this select 0)) then {_this call ACE_Captives_fnc_initPost};"; + }; + }; +}; + diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp new file mode 100644 index 0000000000..da43b21aae --- /dev/null +++ b/addons/captives/CfgMoves.hpp @@ -0,0 +1,90 @@ +class CfgMovesBasic { + class Actions { + class CivilStandActions; + class ACE_CivilStandCaptiveActions: CivilStandActions { + turnL = ""; + turnR = ""; + stop = "ACE_AmovPercMstpScapWnonDnon"; + StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; + default = "ACE_AmovPercMstpScapWnonDnon"; + getOver = ""; + throwPrepare = ""; + throwGrenade[] = {"","Gesture"}; + }; + }; +}; + +class CfgMovesMaleSdr: CfgMovesBasic { + class StandBase; + class States { + class AmovPercMstpSnonWnonDnon: StandBase { + ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + }; + + class CutSceneAnimationBase; + class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { + actions = "ACE_CivilStandCaptiveActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; + speed = 1; + looped = 0; + interpolationRestart = 2; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + }; + + class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; + speed = 0; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01}; + looped = 1; + }; + + class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { + actions = "CivilStandActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; + ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + }; + }; +}; + +/* +player playMove "ACE_AmovPercMstpScapWnonDnon"; +player switchMove "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon"; +*/ + +/*class CfgMovesBasic; +class CfgMovesMaleSdr: CfgMovesBasic { + class States { + class CutSceneAnimationBase; + class AmovPercMstpSnonWnonDnon_EaseIn: CutSceneAnimationBase { + head = "headDefault"; + static = 1; + disableWeapons = 0; + forceAim = 0; + InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseOut",0.02,"Unconscious",0.1}; + }; + class AmovPercMstpSnonWnonDnon_Ease: AmovPercMstpSnonWnonDnon_EaseIn { + looped = 1; + InterpolateTo[] = {"Unconscious",0.1}; + }; + class AmovPercMstpSnonWnonDnon_EaseOut: AmovPercMstpSnonWnonDnon_EaseIn { + InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseIn",0.02,"Unconscious",0.1}; + }; + + class AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { + InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + }; + + class AmovPercMstpSsurWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { + looped = 1; + InterpolateTo[] = {"Unconscious",0.01}; + }; + + class AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { + InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; + }; + }; +};*/ + diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp new file mode 100644 index 0000000000..3036ccf196 --- /dev/null +++ b/addons/captives/CfgVehicles.hpp @@ -0,0 +1,157 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_Actions { + class ACE_SetCaptive { + displayName = "$STR_ACE_Captives_SetCaptive"; + distance = 4; + condition = "'ACE_CableTie' in items _player && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}"; + statement = "player removeItem 'ACE_CableTie'; [_target, true] call ACE_Captives_fnc_setCaptive"; + showDisabled = 0; + priority = 2.4; + icon = "\ACE_Captives\UI\handcuff_ca.paa"; + hotkey = "C"; + }; + class ACE_ReleaseCaptive { + displayName = "$STR_ACE_Captives_ReleaseCaptive"; + distance = 4; + condition = "_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}"; + statement = "[_target, false] call ACE_Captives_fnc_setCaptive"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + priority = 2.4; + icon = "\ACE_Captives\UI\handcuff_ca.paa"; + hotkey = "R"; + }; + class ACE_EscortCaptive { + displayName = "$STR_ACE_Captives_EscortCaptive"; + distance = 4; + condition = "_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}"; + statement = "[_target, true] call ACE_Captives_fnc_escortCaptive"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = "\ACE_Captives\UI\captive_ca.paa"; + priority = 2.3; + hotkey = "E"; + }; + class ACE_StopEscorting { + displayName = "$STR_ACE_Captives_StopEscorting"; + distance = 4; + condition = "_target getVariable ['ACE_isCaptive', false] && {_target in attachedObjects _player}"; + statement = "[_target, false] call ACE_Captives_fnc_escortCaptive"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = "\ACE_Captives\UI\captive_ca.paa"; + priority = 2.3; + hotkey = "E"; + }; + class ACE_LoadCaptive { + displayName = "$STR_ACE_Captives_LoadCaptive"; + distance = 4; + condition = "[_player, _target, objNull] call ACE_Captives_fnc_canLoadCaptive"; + statement = "[_player, _target, objNull] call ACE_Captives_fnc_loadCaptive"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = "\ACE_Captives\UI\captive_ca.paa"; + priority = 2.2; + hotkey = "L"; + }; + class ACE_FriskPerson { + displayName = "$STR_ACE_Captives_FriskPerson"; + distance = 2; + condition = "[_player, _target] call ACE_Captives_fnc_canFriskPerson"; + statement = "[_player, _target] call ACE_Captives_fnc_openFriskMenu"; + showDisabled = 0; + //icon = ""; //@todo + priority = 3; + hotkey = "F"; + }; + }; + + class ACE_SelfActions { + class ACE_StopEscortingSelf { + displayName = "$STR_ACE_Captives_StopEscorting"; + condition = "(_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false] && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}"; + statement = "[_player getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + priority = 2.3; + hotkey = "C"; + }; + /*class ACE_LoadCaptiveSelf { + displayName = "$STR_ACE_Captives_LoadCaptive"; + condition = "[_player, objNull, objNull] call ACE_Captives_fnc_canLoadCaptiveIntoVehicle"; + statement = "[_player, objNull, objNull] call ACE_Captives_fnc_loadCaptiveIntoVehicle"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + priority = 2.2; + hotkey = "K"; + };*/ + }; + }; + + #define MACRO_LOADUNLOADCAPTIVE \ + class ACE_Actions { \ + class ACE_LoadCaptive { \ + displayName = "$STR_ACE_Captives_LoadCaptive"; \ + distance = 4; \ + condition = "[_player, objNull, _target] call ACE_Captives_fnc_canLoadCaptive"; \ + statement = "[_player, objNull, _target] call ACE_Captives_fnc_loadCaptive"; \ + exceptions[] = {"ACE_Interaction_isNotEscorting"}; \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "L"; \ + }; \ + class ACE_UnloadCaptive { \ + displayName = "$STR_ACE_Captives_UnloadCaptive"; \ + distance = 4; \ + condition = "[_player, _target] call ACE_Captives_fnc_canUnloadCaptive"; \ + statement = "[_player, _target] call ACE_Captives_fnc_unloadCaptive"; \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "C"; \ + }; \ + }; + + class LandVehicle; + class Car: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + class Tank: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + + class Air; + class Helicopter: Air { + MACRO_LOADUNLOADCAPTIVE + }; + class Plane: Air { + MACRO_LOADUNLOADCAPTIVE + }; + + class Ship; + class Ship_F: Ship { + MACRO_LOADUNLOADCAPTIVE + }; + + class StaticWeapon: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + + class StaticMortar; + class Mortar_01_base_F: StaticMortar { + MACRO_LOADUNLOADCAPTIVE + }; + + #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_CableTie,12) + }; + }; +}; diff --git a/addons/captives/CfgWeapons.hpp b/addons/captives/CfgWeapons.hpp new file mode 100644 index 0000000000..3005a2fa5c --- /dev/null +++ b/addons/captives/CfgWeapons.hpp @@ -0,0 +1,15 @@ +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_CableTie: ACE_ItemCore { + displayName = "$STR_ACE_Captives_CableTie"; + descriptionShort = "$STR_ACE_Captives_CableTieDescription"; + model = QUOTE(PATHTOF(models\ace_cabletie.p3d)); + picture = QUOTE(PATHTOF(UI\ace_cabletie_ca.paa)); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + }; + }; +}; diff --git a/addons/captives/UI/agm_cabletie_x_ca.paa b/addons/captives/UI/ace_cabletie_ca.paa similarity index 100% rename from addons/captives/UI/agm_cabletie_x_ca.paa rename to addons/captives/UI/ace_cabletie_ca.paa diff --git a/addons/captives/XEH_postInitClient.sqf b/addons/captives/XEH_postInitClient.sqf new file mode 100644 index 0000000000..a08c5d4239 --- /dev/null +++ b/addons/captives/XEH_postInitClient.sqf @@ -0,0 +1,3 @@ +// by commy2 + +[missionNamespace, "playerChanged", {_this call ACE_Captives_fnc_handlePlayerChanged}] call ACE_Core_fnc_addCustomEventhandler; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf new file mode 100644 index 0000000000..5e6f35bc48 --- /dev/null +++ b/addons/captives/XEH_preInit.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(empty); +PREP(canFriskPerson); +PREP(canLoadCaptive); +PREP(canUnloadCaptive); +PREP(escortCaptive); +PREP(handleGetOut); +PREP(handleKnockedOut); +PREP(handlePlayerChanged); +PREP(handleWokeUp); +PREP(initPost); +PREP(initUnit); +PREP(loadCaptive); +PREP(openFriskMenu); +PREP(setCaptive); +PREP(surrender); +PREP(unloadCaptive); + +ADDON = true; diff --git a/addons/captives/agm_cabletie.p3d b/addons/captives/agm_cabletie.p3d deleted file mode 100644 index e0804b8c5ff7324feead360c873d5bd44fec4f6d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 49251 zcmeHwcYIaF)^0&DG8xBLl4Q`GocshMGyjngwUjSL?Cdff*6pZfEX2|NQsCD z$v%5W;UX$X5u^$MX@WHAitw#9=RCRG;okT2e!p+uzuv=dm|3&eto59=)|s=F4Lyp-$7brKt8JdNEb+P~nlIh+1)>{e7D_LEZ zSC3|T@stm&B`eBU8TYP#!F0&I53Gu>l(06Qsi>|Oxp>YxTX<2_cYA+GQ`ftlwxS9Zav;Q^>RC=f1}4+fy1aef6zEp7O=}7#jyyR{Y;yDdEZ3cgUz+Hb&7a z%a`=z+J4CBxIJ|z^S^F|dfF}c-sn_vx1u*Dg?fst`QC_{-&paV-%`SJu1#UHq#3Q~ z8P`g9-iaw}c3wYM@yE9*>uL055wq)=Ws2SwT-LK_e-ZO=4pZ^hESSq<{NBP`zBoeB zv2AmCirsEuHk^G(;eX>yK2K(^)@JD{xzzZVKg{PTHK4V*=+)YaKW@o!YsASov*C_V zMNbGgVa?hTXWst3NJGYdVSA=kHKU(7Vr6bc?`@K4&kC+J-n=zD zx1wX}%(s$)#+!ced6j(wt}U@L+Pr4Ql*_H??lYHIZHB#OUWp0t^4ESLJ$3YKGh@~{ z<)5TJWzv6*pKXQ~NmTrPn`))6PMK?l))=7Zq^UL2<362hc9@i@_)}{yFmBbHX@>fL zrs#nEZ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gS)1MicqRDnl0}aO=+cFES&(=KDJ=^h3hCv0%$=v2XBp>UxWc1J4nn)MX zF`8IbLAKx&ZbqhPvK6Ot0}b1bZ3(onH4k;icKQhtuaTy|c6@>>T-q53|9d6_d;TA< ztTP#A**7NasKr2jpbQWj(ydp7Hx?CC4WhDGf+vfSfG3#K#NYJRY@@{Un2av&GWd|2Lt9LQxp>@`Qtav&E=U0C9R9LQxp>=j4Nav&GWJy_;}9LQxp zUSLTfyK&8SWI2$FB@ZlhKn~^#_eEguD^`mAvkc&s(c;pQ^ zkjs4h!;QzIW;u|{?+1IKQS&^({c67OJru;lLd+|eXZ(my?IEUkQZ?ygIgpD7V|ZW& zIe4(k~*Gbee;QWo)=PDWQ_-n z>l^60vmrTaJZM~}EN6%HcwhgvEsF)@+UDc=m+g1!j4L z2#e$>O#iO^j2xxUODAdVf6|eK`B`kw$oVI|&-6=P0n}f-GRTGAhtkQbf?T|>B+2dP z$8k@tf4Y(+`3~C~IxHzkayus#yqNagg`^ui(x5w744P8@AMxdlO)qY>iV<)u_PXexTaAvE3SCohQB>i>Y>Aqr{6njPzOa5!V(|yH4yuSH| z#sBZV^F1>d*mu;3X8i^vjt=*WV?p%d_rx!FjrDOKBjlQ`%h#CZn%^0>;Xl64W4Irl z;5J|PZ!&!7h~dNNgvN+k$|e8u0YrG)zM~0HC=K|(y|TV$$^&-R2yfJQNwmEd@_H|e uksC3-KC1Zz{{J8SkOke44;t5%V(5 0} diff --git a/addons/captives/functions/fn_canUnloadCaptive.sqf b/addons/captives/functions/fn_canUnloadCaptive.sqf deleted file mode 100644 index 8c52bac0b0..0000000000 --- a/addons/captives/functions/fn_canUnloadCaptive.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Author: commy2 - * - * Check if the unit can unload a captive from the vehicle. - * - * Argument: - * 0: Unit that wants to unload a captive (Object) - * 1: Vehicle to unload a captive from. (Object) - * - * Return value: - * Boolean (Bool) - */ - -private ["_unit", "_vehicle", "_cargo"]; - -_unit = _this select 0; -_vehicle = _this select 1; - -_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. - -_cargo = [_cargo, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter; - -count _cargo > 0 diff --git a/addons/captives/functions/fn_escortCaptive.sqf b/addons/captives/functions/fn_escortCaptive.sqf deleted file mode 100644 index 55244cf2f8..0000000000 --- a/addons/captives/functions/fn_escortCaptive.sqf +++ /dev/null @@ -1,43 +0,0 @@ -//author : Nic547 -//Attaches a Captive to the player - -private ["_unit", "_state"]; - -_unit = _this select 0; -_state = _this select 1; - -if !("AGM_Handcuffed" in ([_unit] call AGM_Core_fnc_getCaptivityStatus)) exitWith { - [localize "STR_AGM_Captives_NoCaptive"] call AGM_Core_fnc_displayTextStructured; -}; - -if (_state) then { - if (player getVariable ["AGM_isEscorting", false]) exitWith {}; - - [player, _unit] call AGM_Core_fnc_claim; - player setVariable ["AGM_isEscorting", true, true]; - - _unit attachTo [player, [0, 1, 0]]; - - player setVariable ["AGM_escortedUnit", _unit, true]; - _actionID = player addAction [format ["%1", localize "STR_AGM_Captives_StopEscorting"], "[player getVariable ['AGM_escortedUnit', objNull], false] call AGM_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (player getVariable ['AGM_escortedUnit', objNull])"]; - - [_unit, _actionID] spawn { - _unit = _this select 0; - _actionID = _this select 1; - - while {player getVariable ["AGM_isEscorting", false]} do { - sleep 0.2; - - if (!alive _unit || {!alive player} || {!canStand _unit} || {!canStand player} || {_unit getVariable ["AGM_isUnconscious", false]} || {player getVariable ["AGM_isUnconscious", false]} || {!isNull (attachedTo player)}) then { - player setVariable ["AGM_isEscorting", false, true]; - }; - }; - [objNull, _unit] call AGM_Core_fnc_claim; - - detach _unit; - player removeAction _actionID; - }; -} else { - player setVariable ["AGM_isEscorting", false, true]; - player setVariable ["AGM_escortedUnit", objNull, true]; -}; diff --git a/addons/captives/functions/fn_handleGetOut.sqf b/addons/captives/functions/fn_handleGetOut.sqf deleted file mode 100644 index 0cb88b0a8e..0000000000 --- a/addons/captives/functions/fn_handleGetOut.sqf +++ /dev/null @@ -1,14 +0,0 @@ -// by commy2 - -private ["_vehicle", "_unit", "_cargoIndex"]; - -_vehicle = _this select 0; -_unit = _this select 2; - -_cargoIndex = _unit getVariable ["AGM_Captives_CargoIndex", -1]; - -if (_cargoIndex != -1) exitWith { - _unit moveInCargo [_vehicle, _cargoIndex]; -}; - -[_unit, 'AGM_AmovPercMstpScapWnonDnon', 2] call AGM_Core_fnc_doAnimation; diff --git a/addons/captives/functions/fn_handlePlayerChanged.sqf b/addons/captives/functions/fn_handlePlayerChanged.sqf deleted file mode 100644 index 5bece824f9..0000000000 --- a/addons/captives/functions/fn_handlePlayerChanged.sqf +++ /dev/null @@ -1,12 +0,0 @@ -// by commy2 - -private ["_unit", "_oldUnit"]; - -_unit = _this select 0; -_oldUnit = _this select 1; - -if (_unit getVariable ["AGM_isCaptive", false]) then { - showHUD false; -} else { - showHUD true; -}; diff --git a/addons/captives/functions/fn_handleWokeUp.sqf b/addons/captives/functions/fn_handleWokeUp.sqf deleted file mode 100644 index facbf9b31f..0000000000 --- a/addons/captives/functions/fn_handleWokeUp.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// by commy2 - -private "_unit"; - -_unit = _this select 0; - -if (_unit getVariable ["AGM_isCaptive", false] && {vehicle _unit == _unit}) then { - [_unit] call AGM_Core_fnc_fixLoweredRifleAnimation; - [_unit, "AGM_AmovPercMstpScapWnonDnon", 0] call AGM_Core_fnc_doAnimation; -}; diff --git a/addons/captives/functions/fn_initPost.sqf b/addons/captives/functions/fn_initPost.sqf deleted file mode 100644 index 73c9674f7a..0000000000 --- a/addons/captives/functions/fn_initPost.sqf +++ /dev/null @@ -1,11 +0,0 @@ -// by commy2 - -private "_unit"; - -_unit = _this select 0; - -// reset status on mission start -if (_unit getVariable ["AGM_isCaptive", false]) then { - _unit setVariable ["AGM_isCaptive", false]; - [_unit, true] call AGM_Captives_fnc_setCaptive; -}; diff --git a/addons/captives/functions/fn_initUnit.sqf b/addons/captives/functions/fn_initUnit.sqf deleted file mode 100644 index 76d4671b7f..0000000000 --- a/addons/captives/functions/fn_initUnit.sqf +++ /dev/null @@ -1,12 +0,0 @@ -// by commy2 - -[_this select 0, "knockedOut", { - if (local (_this select 0)) then {_this call AGM_Captives_fnc_handleKnockedOut}; -}] call AGM_Core_fnc_addCustomEventhandler; - -[_this select 0, "wokeUp", { - if (local (_this select 0)) then {_this call AGM_Captives_fnc_handleWokeUp}; -}] call AGM_Core_fnc_addCustomEventhandler; - -// prevent players from throwing grenades -[_this select 0, "Throw", {(_this select 1) getVariable ["AGM_isCaptive", false]}, {}] call AGM_Core_fnc_addActionEventhandler; diff --git a/addons/captives/functions/fn_setCaptive.sqf b/addons/captives/functions/fn_setCaptive.sqf deleted file mode 100644 index a2e4ed7e3e..0000000000 --- a/addons/captives/functions/fn_setCaptive.sqf +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: Nic547, commy2 - * - * Makes a civilian unable to move. - * - * Argument: - * 0: Unit (Object) - * 1: True to take captive, false to release captive (Object) - * - * Return value: - * Nothing - */ - -private ["_unit", "_state"]; - -_unit = _this select 0; -_state = _this select 1; - -if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call AGM_Core_fnc_execRemoteFnc}; - -if (_state) then { - if (_unit getVariable ["AGM_isCaptive", false]) exitWith {}; - - _unit setVariable ["AGM_isCaptive", true, true]; - - // fix anim on mission start (should work on dedicated servers) - _unit spawn { - [_this, "AGM_Handcuffed", true] call AGM_Core_fnc_setCaptivityStatus; - - if (_this getVariable ["AGM_isCaptive", false] && {vehicle _this == _this}) then { - [_this] call AGM_Core_fnc_fixLoweredRifleAnimation; - [_this, "AGM_AmovPercMstpScapWnonDnon", 0] spawn AGM_Core_fnc_doAnimation; - }; - }; - - _unit setVariable ["AGM_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; - - if (_unit == AGM_player) then { - showHUD false; - }; -} else { - if !(_unit getVariable ["AGM_isCaptive", false]) exitWith {}; - - _unit setVariable ["AGM_isCaptive", false, true]; - [_unit, "AGM_Handcuffed", false] call AGM_Core_fnc_setCaptivityStatus; - if (vehicle _unit == _unit) then { - [_unit, "AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call AGM_Core_fnc_doAnimation; - }; - - if (_unit getVariable ["AGM_Captives_CargoIndex", -1] != -1) then { - _unit setVariable ["AGM_Captives_CargoIndex", -1, true]; - }; - - if (_unit == AGM_player) then { - showHUD true; - }; -}; diff --git a/addons/captives/functions/fn_unloadCaptive.sqf b/addons/captives/functions/fn_unloadCaptive.sqf deleted file mode 100644 index e7849f1c0e..0000000000 --- a/addons/captives/functions/fn_unloadCaptive.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: commy2 - * - * Unit unloads a captive from a vehicle. - * - * Argument: - * 0: Unit that wants to unload a captive (Object) - * 1: Vehicle to unload a captive from. (Object) - * - * Return value: - * Nothing - */ - -private ["_unit", "_vehicle", "_cargo", "_target"]; - -_unit = _this select 0; -_vehicle = _this select 1; - -_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. - -_cargo = [_cargo, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter; - -if (count _cargo > 0) then { - _target = _cargo select 0; - - _target setVariable ["AGM_Captives_CargoIndex", -1, true]; - - moveOut _target; - [_target, "AGM_AmovPercMstpScapWnonDnon", 2] call AGM_Core_fnc_doAnimation; - [_target, "{unassignVehicle _this}", _target] call AGM_Core_fnc_execRemoteFnc; -}; diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf new file mode 100644 index 0000000000..62d5a06742 --- /dev/null +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -0,0 +1,23 @@ +/* + * Author: bux578 + * Checks the conditions for being able to frisk a unit + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +_target getVariable ["ACE_isCaptive", false] +|| {_target getVariable ["ACE_isSearchable", false]} +|| {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf new file mode 100644 index 0000000000..b8021e602f --- /dev/null +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -0,0 +1,38 @@ +/* + * Author: commy2 + * Check if the unit can load the target object into a vehicle. + * + * Arguments: + * 0: Unit that wants to load a captive + * 1: A captive. ObjNull for the first escorted captive + * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +private ["_objects"]; + +PARAMS_3(_unit,_target,_vehicle); + +if (isNull _target) then { + _objects = attachedObjects _unit; + _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + _target = _objects select 0; +}; + +if (isNull _vehicle) then { + _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10]; + _vehicle = _objects select 0; +}; + +_unit getVariable ["ACE_isEscorting", false] +&& {!isNil "_target"} +&& {!isNil "_vehicle"} +&& {_vehicle emptyPositions "cargo" > 0} diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf new file mode 100644 index 0000000000..b714ebc8ae --- /dev/null +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -0,0 +1,28 @@ +/* + * Author: commy2 + * Check if the unit can unload a captive from the vehicle. + * + * Arguments: + * 0: Unit that wants to unload a captive + * 1: A captive. ObjNull for the first escorted captive + * 2: Vehicle to unload a captive from + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +private ["_cargo"]; + +PARAMS_2(_unit,_vehicle); + +_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. + +_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + +count _cargo > 0 diff --git a/addons/captives/functions/fnc_escortCaptive.sqf b/addons/captives/functions/fnc_escortCaptive.sqf new file mode 100644 index 0000000000..c3030a9d33 --- /dev/null +++ b/addons/captives/functions/fnc_escortCaptive.sqf @@ -0,0 +1,55 @@ +/* + * Author: Nic547 + * Attaches a Captive to the player + * + * Arguments: + * 0: _unit + * 1: _state + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_state); + +if !("ACE_Handcuffed" in ([_unit] call ACE_Core_fnc_getCaptivityStatus)) exitWith { + [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); +}; + +if (_state) then { + if (player getVariable ["ACE_isEscorting", false]) exitWith {}; + + [player, _unit] call EFUNC(common,claim); + player setVariable ["ACE_isEscorting", true, true]; + + _unit attachTo [player, [0, 1, 0]]; + + player setVariable ["ACE_escortedUnit", _unit, true]; + _actionID = player addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], "[player getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (player getVariable ['ACE_escortedUnit', objNull])"]; + + [_unit, _actionID] spawn { + _unit = _this select 0; + _actionID = _this select 1; + + while {player getVariable ["ACE_isEscorting", false]} do { + sleep 0.2; + + if (!alive _unit || {!alive player} || {!canStand _unit} || {!canStand player} || {_unit getVariable ["ACE_isUnconscious", false]} || {player getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo player)}) then { + player setVariable ["ACE_isEscorting", false, true]; + }; + }; + [objNull, _unit] call EFUNC(common,claim); + + detach _unit; + player removeAction _actionID; + }; +} else { + player setVariable ["ACE_isEscorting", false, true]; + player setVariable ["ACE_escortedUnit", objNull, true]; +}; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf new file mode 100644 index 0000000000..7cc1fd6f5c --- /dev/null +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -0,0 +1,29 @@ +/* + * Author: commy2 + * X + * + * Arguments: + * 0: _vehicle + * 1: _unit + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_vehicle,_unit); + +private ["_cargoIndex"]; + +_cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; + +if (_cargoIndex != -1) exitWith { + _unit moveInCargo [_vehicle, _cargoIndex]; +}; + +[_unit, 'ACE_AmovPercMstpScapWnonDnon', 2] call EFUNC(common,doAnimation); diff --git a/addons/captives/functions/fn_handleKnockedOut.sqf b/addons/captives/functions/fnc_handleKnockedOut.sqf similarity index 100% rename from addons/captives/functions/fn_handleKnockedOut.sqf rename to addons/captives/functions/fnc_handleKnockedOut.sqf diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..fea03cfe16 --- /dev/null +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,25 @@ +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: _unit + * 1: _oldUnit + * + * Return Value: + * The return value + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_oldUnit); + +if (_unit getVariable ["ACE_isCaptive", false]) then { + showHUD false; +} else { + showHUD true; +}; diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf new file mode 100644 index 0000000000..cbcd2a07ae --- /dev/null +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -0,0 +1,23 @@ +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: _unit + * + * Return Value: + * The return value + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +if (_unit getVariable ["ACE_isCaptive", false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); +}; diff --git a/addons/captives/functions/fnc_initPost.sqf b/addons/captives/functions/fnc_initPost.sqf new file mode 100644 index 0000000000..5c116be417 --- /dev/null +++ b/addons/captives/functions/fnc_initPost.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: _unit + * + * Return Value: + * The return value + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +// reset status on mission start +if (_unit getVariable ["ACE_isCaptive", false]) then { + _unit setVariable ["ACE_isCaptive", false]; + [_unit, true] call ACE_Captives_fnc_setCaptive; +}; diff --git a/addons/captives/functions/fnc_initUnit.sqf b/addons/captives/functions/fnc_initUnit.sqf new file mode 100644 index 0000000000..13777dca1d --- /dev/null +++ b/addons/captives/functions/fnc_initUnit.sqf @@ -0,0 +1,29 @@ +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: _unit + * + * Return Value: + * The return value + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +[_unit, "knockedOut", { + if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; +}] call ACE_Core_fnc_addCustomEventhandler; + +[_unit, "wokeUp", { + if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; +}] call ACE_Core_fnc_addCustomEventhandler; + +// prevent players from throwing grenades +[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call ACE_Core_fnc_addActionEventhandler; diff --git a/addons/captives/functions/fn_loadCaptive.sqf b/addons/captives/functions/fnc_loadCaptive.sqf similarity index 52% rename from addons/captives/functions/fn_loadCaptive.sqf rename to addons/captives/functions/fnc_loadCaptive.sqf index 12bcb35f9b..255581a593 100644 --- a/addons/captives/functions/fn_loadCaptive.sqf +++ b/addons/captives/functions/fnc_loadCaptive.sqf @@ -1,26 +1,27 @@ /* * Author: commy2 - * * Unit loads the target object into a vehicle. - * - * Argument: - * 0: Unit that wants to load a captive (Object) - * 1: A captive. ObjNull for the first escorted captive (Object) - * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (Object) - * - * Return value: + * + * Arguments: + * 0: Unit that wants to load a captive + * 1: A captive. ObjNull for the first escorted captive + * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle + * + * Return Value: * Nothing + * + * Example: + * TODO + * + * Public: No */ +#include "script_component.hpp" -private ["_unit", "_target", "_vehicle", "_objects"]; - -_unit = _this select 0; -_target = _this select 1; -_vehicle = _this select 2; +PARAMS_1(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter; + _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); _target = _objects select 0; }; @@ -30,6 +31,6 @@ if (isNull _vehicle) then { }; if (!isNil "_target" && {!isNil "_vehicle"}) then { - _unit setVariable ["AGM_isEscorting", false]; - [[_target, _vehicle], "{(_this select 0) moveInCargo (_this select 1); (_this select 0) assignAsCargo (_this select 1); (_this select 0) setVariable ['AGM_Captives_CargoIndex', (_this select 1) getCargoIndex (_this select 0), true];}", _target] call AGM_Core_fnc_execRemoteFnc; + _unit setVariable ["ACE_isEscorting", false]; + [[_target, _vehicle], "{(_this select 0) moveInCargo (_this select 1); (_this select 0) assignAsCargo (_this select 1); (_this select 0) setVariable ['ACE_Captives_CargoIndex', (_this select 1) getCargoIndex (_this select 0), true];}", _target] call ACE_Core_fnc_execRemoteFnc; }; diff --git a/addons/captives/functions/fn_openFriskMenu.sqf b/addons/captives/functions/fnc_openFriskMenu.sqf similarity index 54% rename from addons/captives/functions/fn_openFriskMenu.sqf rename to addons/captives/functions/fnc_openFriskMenu.sqf index c7f60ba2e6..42dda4ab66 100644 --- a/addons/captives/functions/fn_openFriskMenu.sqf +++ b/addons/captives/functions/fnc_openFriskMenu.sqf @@ -1,33 +1,33 @@ /* - Name: AGM_Captives_fnc_openFriskMenu - - Author: bux578 - - Description: - Open the select menu with the "personal" items of a frisked unit - It only shows "handgunWeapon", "uniformItems", "vestItems", "backpackItems" and "assignedItems" because every other item is visible on the character - - Parameters: - 0: Object - player unit - 1: Object - unit + * Author: bux578 + * Open the select menu with the "personal" items of a frisked unit. It only shows "handgunWeapon", "uniformItems", "vestItems", "backpackItems" and "assignedItems" because every other item is visible on the character + * + * Arguments: + * 0: player unit + * 1: unit + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" - Returns: - Nothing -*/ +private ["_weapon", "_listedItemClasses", "_actions", "_allGear"]; -private ["_player", "_unit", "_weapon", "_listedItemClasses", "_actions", "_allGear"]; - -_player = _this select 0; -_unit = _this select 1; +PARAMS_2(_player,_unit); _weapon = currentWeapon _player; if (_weapon == primaryWeapon _player && {_weapon != ""}) then { - [_player, "AmovPercMstpSlowWrflDnon", 0] call AGM_Core_fnc_doAnimation; + [_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation); }; _listedItemClasses = []; -_actions = [localize "STR_AGM_Captives_FriskMenuHeader", localize "STR_AGM_Captives_CancelSelection"] call AGM_Interaction_fnc_prepareSelectMenu; +_actions = [localize "STR_ACE_Captives_FriskMenuHeader", localize "STR_ACE_Captives_CancelSelection"] call ACE_Interaction_fnc_prepareSelectMenu; _allGear = []; @@ -59,12 +59,12 @@ if (count (assignedItems _unit) > 0) then { if (isNil "_item" || str _item == "") then { //str _item ? _item = configFile >> "CfgWeapons" >> _x; }; - _actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call AGM_Interaction_fnc_addSelectableItem; + _actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call ACE_Interaction_fnc_addSelectableItem; _listedItemClasses pushBack _x; }; } forEach (_allGear); -[_actions, {call AGM_Interaction_fnc_hideMenu;}, {call AGM_Interaction_fnc_hideMenu;}] call AGM_Interaction_fnc_openSelectMenu; +[_actions, {call ACE_Interaction_fnc_hideMenu;}, {call ACE_Interaction_fnc_hideMenu;}] call ACE_Interaction_fnc_openSelectMenu; // don't need an "Ok" Button ctrlShow [8860, false]; diff --git a/addons/captives/functions/fnc_setCaptive.sqf b/addons/captives/functions/fnc_setCaptive.sqf new file mode 100644 index 0000000000..38ce997a88 --- /dev/null +++ b/addons/captives/functions/fnc_setCaptive.sqf @@ -0,0 +1,59 @@ +/* + * Author: Nic547, commy2 + * Makes a civilian unable to move. + * + * Arguments: + * 0: Unit + * 1: True to take captive, false to release captive + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_state); + +if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; + +if (_state) then { + if (_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + + _unit setVariable ["ACE_isCaptive", true, true]; + + // fix anim on mission start (should work on dedicated servers) + _unit spawn { + [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; + + if (_this getVariable ["ACE_isCaptive", false] && {vehicle _this == _this}) then { + [_this] call EFUNC(common,fixLoweredRifleAnimation); + [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); + }; + }; + + _unit setVariable ["ACE_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; + + if (_unit == ACE_player) then { + showHUD false; + }; +} else { + if !(_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + + _unit setVariable ["ACE_isCaptive", false, true]; + [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; + if (vehicle _unit == _unit) then { + [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); + }; + + if (_unit getVariable ["ACE_Captives_CargoIndex", -1] != -1) then { + _unit setVariable ["ACE_Captives_CargoIndex", -1, true]; + }; + + if (_unit == ACE_player) then { + showHUD true; + }; +}; diff --git a/addons/captives/functions/fn_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf similarity index 53% rename from addons/captives/functions/fn_surrender.sqf rename to addons/captives/functions/fnc_surrender.sqf index 9ba1dbcfc2..b308775040 100644 --- a/addons/captives/functions/fn_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -1,17 +1,30 @@ -// by commy2 +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: Unit + * 1: State + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" -private ["_unit", "_state"]; +PARAMS_2(_unit,_state); -_unit = _this select 0; -_state = _this select 1; - -if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call AGM_Core_fnc_execRemoteFnc}; +if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["AGM_isSurrender", false]) exitWith {}; + if (_unit getVariable ["ACE_isSurrender", false]) exitWith {}; - _unit setVariable ["AGM_isSurrender", true, true]; - [_unit, "AGM_Surrendered", true] call AGM_Core_fnc_setCaptivityStatus; + _unit setVariable ["ACE_isSurrender", true, true]; + [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; _unit spawn { // fix for lowered rifle animation glitch @@ -19,29 +32,29 @@ if (_state) then { _this playMove "amovpercmstpsraswrfldnon"; }; - while {_this getVariable ["AGM_isSurrender", false]} do { + while {_this getVariable ["ACE_isSurrender", false]} do { sleep 0.001; //sleep in UI if (isPlayer _this) then {showHUD false}; - if (!alive _this || {_this getVariable ["AGM_isUnconscious", false]}) then { - _this setVariable ["AGM_isSurrender", false, true]; + if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { + _this setVariable ["ACE_isSurrender", false, true]; } else { _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; }; }; - if !(_this getVariable ["AGM_isUnconscious", false]) then { + if !(_this getVariable ["ACE_isUnconscious", false]) then { _this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; } else { _this playMoveNow "unconscious"; }; - [_this, "AGM_Surrendered", false] call AGM_Core_fnc_setCaptivityStatus; + [_this, "ACE_Surrendered", false] call ACE_Core_fnc_setCaptivityStatus; if (isPlayer _this) then {showHUD true}; }; } else { - _unit setVariable ["AGM_isSurrender", false, true]; + _unit setVariable ["ACE_isSurrender", false, true]; }; /* diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_unloadCaptive.sqf new file mode 100644 index 0000000000..01e1d48e74 --- /dev/null +++ b/addons/captives/functions/fnc_unloadCaptive.sqf @@ -0,0 +1,35 @@ +/* + * Author: commy2 + * Unit unloads a captive from a vehicle. + * + * Arguments: + * 0: Unit that wants to unload a captive + * 1: Vehicle to unload a captive from. + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_vehicle); + +private ["_cargo", "_target"]; + +_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. + +_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + +if (count _cargo > 0) then { + _target = _cargo select 0; + + _target setVariable ["ACE_Captives_CargoIndex", -1, true]; + + moveOut _target; + [_target, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); + [_target, "{unassignVehicle _this}", _target] call ACE_Core_fnc_execRemoteFnc; +}; diff --git a/addons/captives/functions/script_component.hpp b/addons/captives/functions/script_component.hpp new file mode 100644 index 0000000000..3cc9111162 --- /dev/null +++ b/addons/captives/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\blank\script_component.hpp" \ No newline at end of file diff --git a/addons/captives/models/ace_cabletie.p3d b/addons/captives/models/ace_cabletie.p3d new file mode 100644 index 0000000000000000000000000000000000000000..72a6facd2bd7aa35487f2e4bd7e05b9f3bc495e7 GIT binary patch literal 52371 zcmeHwcYGJc)^|b;5J>0&DG8xBLl4RBOz1^=5rhCCg(kfhfxx8-VnB)lVpNbKB_bju z``eAeMO2U?9fW{1L7H?$c+Z*qzPa4t-skaoKkvKupC^2VnKOI#obR6b{^qyYIXh|F zrhQXiUmu^GK0ZDj>NIUzifSK{7gO~v6|VWG>8tCln`f$9!4JoUv%GuXdMj>uC9BKw z>X9rjp7No!WJMV({r-(FSq{4Yp;hs<64u7E71i+~m(E+~3NMQIe(#T|>Ug&c)`UiB z5n+oaMX)@+_YG_9(_#^|@*hyg#~-|5ec5|pM9rDg)$uJY3V3Q=9AP|oRxOS7hfFEp zNlF=Q_}?kAgXJ}Q3VGK2+}C(xdvXJouf1K!Q@(f~W8j7B|Pc-4jHw}Mk#q^ z`I4So+YcEXx2No6{Wq*&PrC&_7@bP)R`SNgU{8@XKNu178!P<_TS|D&w<&CvG$WNf z<9Z3tyHSPB&gf=7l$c1 zx@|5`u{$lyhO-YT{BNGk=gH{R+ALiqmpcE|kMem+^>1x1dcC&Nk6CiU8h$FqY`7y> z$>aS_TC?`Vn0J0J(vb0A+@4`oO^-K+ugtCFy-hN#yhq~A4;O?e{p9`gtiW31%-h3q zD>%|tV*Ty79fwO z@k#7cChgbQ*=BH&1f}n@saD$RWjs8kboLVz2=CiqGhe;VqKc)5p<95xNX0Y$) zO7`3TmJwcNrWsSO?tnl^e?o{XZDXMXb#Kx zM9Ci)%4asMUeKHtwn^!){yM-cniybCua=_ZbAJYyjTZ!%y)S;O^gr*G)2visi*c)2 zx{@b`<}}~FyxBPP-8)ME=0rd9K+jK&+O?J_x%L)6v)%GfjRj|Ir9UF#5994FB@9{R zxRS3N`rYV!JjjUsae~tCTinNd78zt@%Qjibt6uRj<8}rax86Rg^amV1VFbUwH?>2R z>}ovyd!H~ee)=wT^^}*CzHOZ~-o1G@wS3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msM!weVtE3~60ifitjE85^7*LQ4(#&vU_S!XJWp`HnlHRhTk#YY z^9tq}AJS9r@e`j^P5#&p?Bbaso;AV_o~QHq*be};vg5UjCuew~20O6J=i_~T)XI+6 zE}jqJxe@HZuEI|b!}xQC_m!0$uU$L^!P61gfnDXF9{KS3cyC(0-%aQ9qaHkU!P6Gl zfn7Z4zyl79BgU1-iJv9J@byrgOf`=q#udNLi|6jegi(f$SiwEq$F2_~9=SqILX8-E_U$0%< zX5;o6cCzf!`FLLzwX)~6iI!3Jc8VkF$*9n@`sByp-G`>wL&KzJZQA8_7|SK|CsA_y#q+o)*FPOelzfMsNgcM7D7l@J3VvAj z-i4!!YPQ5j*qZkziqFc_RG6Z;pShO#lZi7Q#H^Yv@tJwDdVHeTN?s*rTH-7H$C-(e zx zGvdXwWHi{4K33dUNGY(T%rpPm*zwgd4nB(u$1M}R!laJp!(PkW`fFpS zj}>2CQ9j*k>93ESK2{u)V$WG(%YSX`^s!c1aDZrH15R zK7a^q+jkTJ3Z@hOyPvGDneu?0bw(y@GDWmABa}IMS&H0<^7c{9KhXbw(GOej4f~LB bTsemCs7wqv23_F!zwdwHYxv5Hf?fX)mwKPg literal 0 HcmV?d00001 diff --git a/addons/captives/models/ace_default.rvmat b/addons/captives/models/ace_default.rvmat new file mode 100644 index 0000000000..c7a241ca38 --- /dev/null +++ b/addons/captives/models/ace_default.rvmat @@ -0,0 +1,79 @@ +ambient[]={1,1,1,1}; +diffuse[]={1,1,1,1}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.01,0.01,0.01,1}; //amount of glossiness - the higher the number, the higher the glossiness +specularPower=500; //area of glossiness - the higher the number, the smaller the area +PixelShaderID="Super"; +VertexShaderID="Super"; + +class Stage1 { + texture="#(rgb,1,1,1)color(0.5,0.5,1,1)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 { + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 { + texture="#(argb,8,8,3)color(0,0,0,0,mc)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 { + texture="#(argb,8,8,3)color(1,1,1,1,as)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,1}; + }; +}; +class Stage5 { + texture="#(rgb,1,1,1)color(0.2,0.2,1,1)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 { + texture="#(ai,64,64,1)fresnel(4.7,1.2)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; +class Stage7 { + texture="a3\data_f\env_land_ca.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/captives/script_component.hpp b/addons/captives/script_component.hpp new file mode 100644 index 0000000000..e68eb19d2f --- /dev/null +++ b/addons/captives/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT captives +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_CAPTIVES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_CAPTIVES + #define DEBUG_SETTINGS DEBUG_SETTINGS_CAPTIVES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 060f89d9ec..eaf63b2d41 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -1,8 +1,8 @@  - + - + Take Prisoner Gefangen nehmen Tomar prisionero @@ -14,7 +14,7 @@ Foglyul ejtés Взять в плен - + Free Prisoner Gefangenen freilassen Liberar prisionero @@ -26,7 +26,7 @@ Fogoly szabadon elengedése Освободить пленника - + Escort Prisoner Gefangenen eskortieren Escoltar prisionero @@ -38,7 +38,7 @@ Fogoly kísérése Конвоировать пленника - + Release Prisoner Gefangenen loslassen Soltar prisionero @@ -50,7 +50,7 @@ Fogoly elengedése Прекратить конвоирование - + You need to take him as prisoner first! Du must ihn zuerst gefangen nehmen. Necesitas hacerle prisionero primero! @@ -62,7 +62,7 @@ Először foglyul kell ejtened! Вы должны сначала взять его в плен! - + Load Captive Gefangenen einladen Cargar prisionero @@ -72,7 +72,7 @@ Fogoly berakása Загрузить пленного - + Unload Captive Gefangenen ausladen Descargar prisionero @@ -82,7 +82,7 @@ Fogoly kivevése Выгрузить пленного - + Cable Tie Kabelbinder Opaska zaciskowa @@ -94,7 +94,7 @@ Gyorskötöző Кабельная стяжка - + Cable ties that allow you to restrain prisoners. Kabelbinder ermöglichen es, Gefangene zu fesseln. Opaska zaciskowa pozwala na skrępowanie dłoni u więźnia. @@ -106,7 +106,7 @@ Gyorskötöző emberek fogjulejtéséhez. Кабельные стяжки позволяют связывать пленников. - + Inventory of frisked person Inventar der durchsuchten Person Inventaire de la fouille @@ -116,7 +116,7 @@ Ekwipunek rewidowanej osoby Инвентарь обысканных лиц - + Frisk person Person durchsuchen Fouiller From 4156143ecfd5f5c8aa6f983838052a4ee3a76455 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 3 Feb 2015 00:42:34 -0600 Subject: [PATCH 03/16] Captives Progress --- addons/captives/CfgEventHandlers.hpp | 2 +- addons/captives/CfgVehicles.hpp | 46 +++++++++---------- addons/captives/XEH_preInit.sqf | 3 +- addons/captives/config.cpp | 3 ++ .../captives/functions/fnc_handleGetOut.sqf | 11 +++-- addons/captives/functions/fnc_loadCaptive.sqf | 6 +-- .../captives/functions/fnc_unloadCaptive.sqf | 10 ++-- .../captives/functions/script_component.hpp | 2 +- 8 files changed, 45 insertions(+), 38 deletions(-) diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index eb08f7e865..b8c182d1f6 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -23,7 +23,7 @@ class Extended_GetIn_EventHandlers { class Extended_GetOut_EventHandlers { class All { class GVAR(AutoDetachCaptive) { - getOut = "if (local (_this select 2) && {(_this select 2) getVariable ['ACE_isCaptive', false]}) then {_this call ACE_Captives_fnc_handleGetOut}"; + getOut = QUOTE(_this call FUNC(handleGetOut)); }; }; }; diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 3036ccf196..8758788b2a 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -5,62 +5,62 @@ class CfgVehicles { class ACE_SetCaptive { displayName = "$STR_ACE_Captives_SetCaptive"; distance = 4; - condition = "'ACE_CableTie' in items _player && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}"; - statement = "player removeItem 'ACE_CableTie'; [_target, true] call ACE_Captives_fnc_setCaptive"; + condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}); + statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_2(_target, true)] call FUNC(setCaptive);); showDisabled = 0; priority = 2.4; - icon = "\ACE_Captives\UI\handcuff_ca.paa"; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); hotkey = "C"; }; class ACE_ReleaseCaptive { displayName = "$STR_ACE_Captives_ReleaseCaptive"; distance = 4; - condition = "_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}"; - statement = "[_target, false] call ACE_Captives_fnc_setCaptive"; + condition = QUOTE(_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}); + statement = QUOTE([ARR_2(_target, false)] call FUNC(setCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.4; - icon = "\ACE_Captives\UI\handcuff_ca.paa"; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); hotkey = "R"; }; class ACE_EscortCaptive { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; - condition = "_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}"; - statement = "[_target, true] call ACE_Captives_fnc_escortCaptive"; + condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}); + statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; - icon = "\ACE_Captives\UI\captive_ca.paa"; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.3; hotkey = "E"; }; class ACE_StopEscorting { displayName = "$STR_ACE_Captives_StopEscorting"; distance = 4; - condition = "_target getVariable ['ACE_isCaptive', false] && {_target in attachedObjects _player}"; - statement = "[_target, false] call ACE_Captives_fnc_escortCaptive"; + condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {_target in (attachedObjects _player)}); + statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; - icon = "\ACE_Captives\UI\captive_ca.paa"; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.3; hotkey = "E"; }; class ACE_LoadCaptive { displayName = "$STR_ACE_Captives_LoadCaptive"; distance = 4; - condition = "[_player, _target, objNull] call ACE_Captives_fnc_canLoadCaptive"; - statement = "[_player, _target, objNull] call ACE_Captives_fnc_loadCaptive"; + condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); + statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(loadCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; - icon = "\ACE_Captives\UI\captive_ca.paa"; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.2; hotkey = "L"; }; class ACE_FriskPerson { displayName = "$STR_ACE_Captives_FriskPerson"; distance = 2; - condition = "[_player, _target] call ACE_Captives_fnc_canFriskPerson"; - statement = "[_player, _target] call ACE_Captives_fnc_openFriskMenu"; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(openFriskMenu)); showDisabled = 0; //icon = ""; //@todo priority = 3; @@ -71,8 +71,8 @@ class CfgVehicles { class ACE_SelfActions { class ACE_StopEscortingSelf { displayName = "$STR_ACE_Captives_StopEscorting"; - condition = "(_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false] && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}"; - statement = "[_player getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;"; + condition = QUOTE(((_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}); + statement = QUOTE([ARR_2((_player getVariable ['ACE_escortedUnit', objNull]), false)] call FUNC(_escortCaptive);); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.3; @@ -95,8 +95,8 @@ class CfgVehicles { class ACE_LoadCaptive { \ displayName = "$STR_ACE_Captives_LoadCaptive"; \ distance = 4; \ - condition = "[_player, objNull, _target] call ACE_Captives_fnc_canLoadCaptive"; \ - statement = "[_player, objNull, _target] call ACE_Captives_fnc_loadCaptive"; \ + condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ + statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(loadCaptive)); \ exceptions[] = {"ACE_Interaction_isNotEscorting"}; \ showDisabled = 0; \ priority = 1.2; \ @@ -105,8 +105,8 @@ class CfgVehicles { class ACE_UnloadCaptive { \ displayName = "$STR_ACE_Captives_UnloadCaptive"; \ distance = 4; \ - condition = "[_player, _target] call ACE_Captives_fnc_canUnloadCaptive"; \ - statement = "[_player, _target] call ACE_Captives_fnc_unloadCaptive"; \ + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ + statement = QUOTE([ARR_2(_player, _target)] call FUNC(unloadCaptive)); \ showDisabled = 0; \ priority = 1.2; \ hotkey = "C"; \ diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 5e6f35bc48..7f83ce4fad 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -1,8 +1,7 @@ #include "script_component.hpp" ADDON = false; - -PREP(empty); + PREP(canFriskPerson); PREP(canLoadCaptive); PREP(canUnloadCaptive); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index 7aaa310183..7e5c3382bb 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -13,6 +13,9 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgMoves.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" class ACE_Core_canInteractConditions { diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index 7cc1fd6f5c..f734fa0177 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -1,9 +1,10 @@ /* * Author: commy2 - * X + * Handles when a captive unit gets out of a vehicle. * * Arguments: * 0: _vehicle + * 2: dunno * 1: _unit * * Return Value: @@ -16,14 +17,18 @@ */ #include "script_component.hpp" -PARAMS_2(_vehicle,_unit); +PARAMS_3(_vehicle,_dontcare,_unit); + +if (!local _unit) exitWith {}; +if (!(_unit getVariable ["ACE_isCaptive", false])) exitWith {}; private ["_cargoIndex"]; _cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; +//If captive was not "unloaded", then move them back into the vehicle. if (_cargoIndex != -1) exitWith { _unit moveInCargo [_vehicle, _cargoIndex]; }; -[_unit, 'ACE_AmovPercMstpScapWnonDnon', 2] call EFUNC(common,doAnimation); +[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_loadCaptive.sqf index 255581a593..f2b1a9a0c1 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_loadCaptive.sqf @@ -20,9 +20,9 @@ PARAMS_1(_unit,_target,_vehicle); if (isNull _target) then { - _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); - _target = _objects select 0; + // _objects = attachedObjects _unit; + // _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + // _target = _objects select 0; }; if (isNull _vehicle) then { diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_unloadCaptive.sqf index 01e1d48e74..e6eb4b24a5 100644 --- a/addons/captives/functions/fnc_unloadCaptive.sqf +++ b/addons/captives/functions/fnc_unloadCaptive.sqf @@ -25,11 +25,11 @@ _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turr _cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); if (count _cargo > 0) then { - _target = _cargo select 0; + _target = _cargo select 0; - _target setVariable ["ACE_Captives_CargoIndex", -1, true]; + _target setVariable ["ACE_Captives_CargoIndex", -1, true]; - moveOut _target; - [_target, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); - [_target, "{unassignVehicle _this}", _target] call ACE_Core_fnc_execRemoteFnc; + moveOut _target; + [_target, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); + [_target, "{unassignVehicle _this}", _target] call ACE_Core_fnc_execRemoteFnc; }; diff --git a/addons/captives/functions/script_component.hpp b/addons/captives/functions/script_component.hpp index 3cc9111162..e91d5c843b 100644 --- a/addons/captives/functions/script_component.hpp +++ b/addons/captives/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\blank\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\captives\script_component.hpp" \ No newline at end of file From 4c727fbff593ff126c017ea3e948e2d91736cfd0 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 3 Feb 2015 23:13:44 -0600 Subject: [PATCH 04/16] remoteFncs -> events --- addons/captives/CfgVehicles.hpp | 286 +++++++++--------- addons/captives/XEH_postInitClient.sqf | 6 + addons/captives/functions/fnc_loadCaptive.sqf | 16 +- addons/captives/functions/fnc_setCaptive.sqf | 50 +-- .../captives/functions/fnc_unloadCaptive.sqf | 11 +- .../functions/fnc_vehicleCaptiveMoveIn.sqf | 28 ++ .../functions/fnc_vehicleCaptiveMoveOut.sqf | 24 ++ 7 files changed, 238 insertions(+), 183 deletions(-) create mode 100644 addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf create mode 100644 addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 8758788b2a..dd4f6361d7 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -1,84 +1,84 @@ class CfgVehicles { - class Man; - class CAManBase: Man { - class ACE_Actions { - class ACE_SetCaptive { - displayName = "$STR_ACE_Captives_SetCaptive"; - distance = 4; - condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}); - statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_2(_target, true)] call FUNC(setCaptive);); - showDisabled = 0; - priority = 2.4; - icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); - hotkey = "C"; - }; - class ACE_ReleaseCaptive { - displayName = "$STR_ACE_Captives_ReleaseCaptive"; - distance = 4; - condition = QUOTE(_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}); - statement = QUOTE([ARR_2(_target, false)] call FUNC(setCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; - showDisabled = 0; - priority = 2.4; - icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); - hotkey = "R"; - }; - class ACE_EscortCaptive { - displayName = "$STR_ACE_Captives_EscortCaptive"; - distance = 4; - condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}); - statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); - priority = 2.3; - hotkey = "E"; - }; - class ACE_StopEscorting { - displayName = "$STR_ACE_Captives_StopEscorting"; - distance = 4; - condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {_target in (attachedObjects _player)}); - statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); - priority = 2.3; - hotkey = "E"; - }; - class ACE_LoadCaptive { - displayName = "$STR_ACE_Captives_LoadCaptive"; - distance = 4; - condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); - statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(loadCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); - priority = 2.2; - hotkey = "L"; - }; - class ACE_FriskPerson { - displayName = "$STR_ACE_Captives_FriskPerson"; - distance = 2; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(openFriskMenu)); - showDisabled = 0; - //icon = ""; //@todo - priority = 3; - hotkey = "F"; - }; - }; + class Man; + class CAManBase: Man { + class ACE_Actions { + class ACE_SetCaptive { + displayName = "$STR_ACE_Captives_SetCaptive"; + distance = 4; + condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}); + statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3(QGVAR(SetCaptive), [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent);); + showDisabled = 0; + priority = 2.4; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); + hotkey = "C"; + }; + class ACE_ReleaseCaptive { + displayName = "$STR_ACE_Captives_ReleaseCaptive"; + distance = 4; + condition = QUOTE(_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}); + statement = QUOTE([ARR_2(_target, false)] call FUNC(setCaptive)); + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + priority = 2.4; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); + hotkey = "R"; + }; + class ACE_EscortCaptive { + displayName = "$STR_ACE_Captives_EscortCaptive"; + distance = 4; + condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}); + statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.3; + hotkey = "E"; + }; + class ACE_StopEscorting { + displayName = "$STR_ACE_Captives_StopEscorting"; + distance = 4; + condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {_target in (attachedObjects _player)}); + statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.3; + hotkey = "E"; + }; + class ACE_LoadCaptive { + displayName = "$STR_ACE_Captives_LoadCaptive"; + distance = 4; + condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); + statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(loadCaptive)); + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.2; + hotkey = "L"; + }; + class ACE_FriskPerson { + displayName = "$STR_ACE_Captives_FriskPerson"; + distance = 2; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(openFriskMenu)); + showDisabled = 0; + //icon = ""; //@todo + priority = 3; + hotkey = "F"; + }; + }; - class ACE_SelfActions { - class ACE_StopEscortingSelf { - displayName = "$STR_ACE_Captives_StopEscorting"; - condition = QUOTE(((_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}); - statement = QUOTE([ARR_2((_player getVariable ['ACE_escortedUnit', objNull]), false)] call FUNC(_escortCaptive);); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; - showDisabled = 0; - priority = 2.3; - hotkey = "C"; - }; - /*class ACE_LoadCaptiveSelf { + class ACE_SelfActions { + class ACE_StopEscortingSelf { + displayName = "$STR_ACE_Captives_StopEscorting"; + condition = QUOTE(((_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}); + statement = QUOTE([ARR_2((_player getVariable ['ACE_escortedUnit', objNull]), false)] call FUNC(_escortCaptive);); + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + priority = 2.3; + hotkey = "C"; + }; + /*class ACE_LoadCaptiveSelf { displayName = "$STR_ACE_Captives_LoadCaptive"; condition = "[_player, objNull, objNull] call ACE_Captives_fnc_canLoadCaptiveIntoVehicle"; statement = "[_player, objNull, objNull] call ACE_Captives_fnc_loadCaptiveIntoVehicle"; @@ -86,72 +86,72 @@ class CfgVehicles { showDisabled = 0; priority = 2.2; hotkey = "K"; - };*/ - }; - }; - - #define MACRO_LOADUNLOADCAPTIVE \ - class ACE_Actions { \ - class ACE_LoadCaptive { \ - displayName = "$STR_ACE_Captives_LoadCaptive"; \ - distance = 4; \ - condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ - statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(loadCaptive)); \ - exceptions[] = {"ACE_Interaction_isNotEscorting"}; \ - showDisabled = 0; \ - priority = 1.2; \ - hotkey = "L"; \ - }; \ - class ACE_UnloadCaptive { \ - displayName = "$STR_ACE_Captives_UnloadCaptive"; \ - distance = 4; \ - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ - statement = QUOTE([ARR_2(_player, _target)] call FUNC(unloadCaptive)); \ - showDisabled = 0; \ - priority = 1.2; \ - hotkey = "C"; \ - }; \ + };*/ + }; }; - class LandVehicle; - class Car: LandVehicle { - MACRO_LOADUNLOADCAPTIVE - }; - class Tank: LandVehicle { - MACRO_LOADUNLOADCAPTIVE - }; +#define MACRO_LOADUNLOADCAPTIVE \ + class ACE_Actions { \ + class ACE_LoadCaptive { \ + displayName = "$STR_ACE_Captives_LoadCaptive"; \ + distance = 4; \ + condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ + statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(loadCaptive)); \ + exceptions[] = {"ACE_Interaction_isNotEscorting"}; \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "L"; \ + }; \ + class ACE_UnloadCaptive { \ + displayName = "$STR_ACE_Captives_UnloadCaptive"; \ + distance = 4; \ + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ + statement = QUOTE([ARR_2(_player, _target)] call FUNC(unloadCaptive)); \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "C"; \ + }; \ + }; - class Air; - class Helicopter: Air { - MACRO_LOADUNLOADCAPTIVE - }; - class Plane: Air { - MACRO_LOADUNLOADCAPTIVE - }; - - class Ship; - class Ship_F: Ship { - MACRO_LOADUNLOADCAPTIVE - }; - - class StaticWeapon: LandVehicle { - MACRO_LOADUNLOADCAPTIVE - }; - - class StaticMortar; - class Mortar_01_base_F: StaticMortar { - MACRO_LOADUNLOADCAPTIVE - }; - - #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ - }; - - class Box_NATO_Support_F; - class ACE_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(ACE_CableTie,12) + class LandVehicle; + class Car: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + class Tank: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + + class Air; + class Helicopter: Air { + MACRO_LOADUNLOADCAPTIVE + }; + class Plane: Air { + MACRO_LOADUNLOADCAPTIVE + }; + + class Ship; + class Ship_F: Ship { + MACRO_LOADUNLOADCAPTIVE + }; + + class StaticWeapon: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + + class StaticMortar; + class Mortar_01_base_F: StaticMortar { + MACRO_LOADUNLOADCAPTIVE + }; + +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_CableTie,12) + }; }; - }; }; diff --git a/addons/captives/XEH_postInitClient.sqf b/addons/captives/XEH_postInitClient.sqf index a08c5d4239..a461b36aeb 100644 --- a/addons/captives/XEH_postInitClient.sqf +++ b/addons/captives/XEH_postInitClient.sqf @@ -1,3 +1,9 @@ // by commy2 [missionNamespace, "playerChanged", {_this call ACE_Captives_fnc_handlePlayerChanged}] call ACE_Core_fnc_addCustomEventhandler; + + + +[QGVAR(MoveIn), {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); +[QGVAR(MoveOut), {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +[QGVAR(SetCaptive), {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_loadCaptive.sqf index f2b1a9a0c1..2648255c3b 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_loadCaptive.sqf @@ -20,17 +20,17 @@ PARAMS_1(_unit,_target,_vehicle); if (isNull _target) then { - // _objects = attachedObjects _unit; - // _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); - // _target = _objects select 0; + _objects = attachedObjects _unit; + _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + _target = _objects select 0; }; if (isNull _vehicle) then { - _objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; - _vehicle = _objects select 0; + _objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; + _vehicle = _objects select 0; }; -if (!isNil "_target" && {!isNil "_vehicle"}) then { - _unit setVariable ["ACE_isEscorting", false]; - [[_target, _vehicle], "{(_this select 0) moveInCargo (_this select 1); (_this select 0) assignAsCargo (_this select 1); (_this select 0) setVariable ['ACE_Captives_CargoIndex', (_this select 1) getCargoIndex (_this select 0), true];}", _target] call ACE_Core_fnc_execRemoteFnc; +if ((!isNil "_target") && {!isNil "_vehicle"}) then { + _unit setVariable ["ACE_isEscorting", false]; + [QGVAR(MoveIn), [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); }; diff --git a/addons/captives/functions/fnc_setCaptive.sqf b/addons/captives/functions/fnc_setCaptive.sqf index 38ce997a88..b4c047dd1b 100644 --- a/addons/captives/functions/fnc_setCaptive.sqf +++ b/addons/captives/functions/fnc_setCaptive.sqf @@ -21,39 +21,39 @@ PARAMS_2(_unit,_state); if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + if (_unit getVariable ["ACE_isCaptive", false]) exitWith {}; - _unit setVariable ["ACE_isCaptive", true, true]; + _unit setVariable ["ACE_isCaptive", true, true]; - // fix anim on mission start (should work on dedicated servers) - _unit spawn { - [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; + // fix anim on mission start (should work on dedicated servers) + _unit spawn { + [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; - if (_this getVariable ["ACE_isCaptive", false] && {vehicle _this == _this}) then { - [_this] call EFUNC(common,fixLoweredRifleAnimation); - [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); + if (_this getVariable ["ACE_isCaptive", false] && {vehicle _this == _this}) then { + [_this] call EFUNC(common,fixLoweredRifleAnimation); + [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); + }; }; - }; - _unit setVariable ["ACE_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; + _unit setVariable ["ACE_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; - if (_unit == ACE_player) then { - showHUD false; - }; + if (_unit == ACE_player) then { + showHUD false; + }; } else { - if !(_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + if !(_unit getVariable ["ACE_isCaptive", false]) exitWith {}; - _unit setVariable ["ACE_isCaptive", false, true]; - [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; - if (vehicle _unit == _unit) then { - [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); - }; + _unit setVariable ["ACE_isCaptive", false, true]; + [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; + if (vehicle _unit == _unit) then { + [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); + }; - if (_unit getVariable ["ACE_Captives_CargoIndex", -1] != -1) then { - _unit setVariable ["ACE_Captives_CargoIndex", -1, true]; - }; + if (_unit getVariable ["ACE_Captives_CargoIndex", -1] != -1) then { + _unit setVariable ["ACE_Captives_CargoIndex", -1, true]; + }; - if (_unit == ACE_player) then { - showHUD true; - }; + if (_unit == ACE_player) then { + showHUD true; + }; }; diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_unloadCaptive.sqf index e6eb4b24a5..2ede9de480 100644 --- a/addons/captives/functions/fnc_unloadCaptive.sqf +++ b/addons/captives/functions/fnc_unloadCaptive.sqf @@ -24,12 +24,9 @@ _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turr _cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); -if (count _cargo > 0) then { +if ((count _cargo) > 0) then { _target = _cargo select 0; - - _target setVariable ["ACE_Captives_CargoIndex", -1, true]; - - moveOut _target; - [_target, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); - [_target, "{unassignVehicle _this}", _target] call ACE_Core_fnc_execRemoteFnc; + [QGVAR(MoveOut), [_target], [_target]] call EFUNC(common,targetEvent); +} else { + ERROR("No captive to unload"); }; diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf new file mode 100644 index 0000000000..1eb1c2ef2b --- /dev/null +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -0,0 +1,28 @@ +/* + * Author: PabstMirror + * Loads a captive into a vehicle + * + * Arguments: + * 0: The Captive + * 1: The Vehicle + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_target,_vehicle); + +private ["_cargoIndex"]; + +_target moveInCargo _vehicle; +_target assignAsCargo _vehicle; +_cargoIndex = _vehicle getCargoIndex _target; +_target setVariable ["ACE_Captives_CargoIndex", _cargoIndex, true]; + +TRACE_3("moveinEH",_target,_vehicle,_cargoIndex); diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf new file mode 100644 index 0000000000..0a10572909 --- /dev/null +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf @@ -0,0 +1,24 @@ +/* + * Author: PabstMirror + * Unloads a captive from a vehicle. + * + * Arguments: + * 0: Captive Unit being unloaded + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +_unit setVariable ["ACE_Captives_CargoIndex", -1, true]; + +moveOut _unit; +[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); +unassignVehicle _unit; \ No newline at end of file From 24ab11a1e2740d724d6626c6ba7497dc780d72d5 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 3 Feb 2015 23:56:51 -0600 Subject: [PATCH 05/16] More work --- addons/captives/CfgMoves.hpp | 110 +++++++++--------- addons/captives/CfgVehicles.hpp | 16 +-- addons/captives/CfgWeapons.hpp | 22 ++-- addons/captives/README.md | 14 +++ addons/captives/XEH_postInitClient.sqf | 18 ++- addons/captives/XEH_preInit.sqf | 2 + .../functions/fnc_handlePlayerChanged.sqf | 4 +- .../captives/functions/fnc_handleWokeUp.sqf | 4 +- addons/captives/functions/fnc_initPost.sqf | 4 +- addons/captives/functions/fnc_initUnit.sqf | 9 +- addons/captives/functions/fnc_loadCaptive.sqf | 4 +- .../captives/functions/fnc_openFriskMenu.sqf | 28 ++--- addons/captives/functions/fnc_surrender.sqf | 62 +++++----- .../captives/functions/fnc_unloadCaptive.sqf | 2 +- .../functions/fnc_vehicleCaptiveMoveIn.sqf | 4 +- 15 files changed, 161 insertions(+), 142 deletions(-) create mode 100644 addons/captives/README.md diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index da43b21aae..ab379de6ae 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -1,90 +1,90 @@ class CfgMovesBasic { - class Actions { - class CivilStandActions; - class ACE_CivilStandCaptiveActions: CivilStandActions { - turnL = ""; - turnR = ""; - stop = "ACE_AmovPercMstpScapWnonDnon"; - StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; - default = "ACE_AmovPercMstpScapWnonDnon"; - getOver = ""; - throwPrepare = ""; - throwGrenade[] = {"","Gesture"}; + class Actions { + class CivilStandActions; + class ACE_CivilStandCaptiveActions: CivilStandActions { + turnL = ""; + turnR = ""; + stop = "ACE_AmovPercMstpScapWnonDnon"; + StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; + default = "ACE_AmovPercMstpScapWnonDnon"; + getOver = ""; + throwPrepare = ""; + throwGrenade[] = {"","Gesture"}; + }; }; - }; }; class CfgMovesMaleSdr: CfgMovesBasic { - class StandBase; - class States { - class AmovPercMstpSnonWnonDnon: StandBase { - ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; - }; + class StandBase; + class States { + class AmovPercMstpSnonWnonDnon: StandBase { + ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + }; - class CutSceneAnimationBase; - class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { - actions = "ACE_CivilStandCaptiveActions"; - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; - speed = 1; - looped = 0; - interpolationRestart = 2; - ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - }; + class CutSceneAnimationBase; + class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { + actions = "ACE_CivilStandCaptiveActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; + speed = 1; + looped = 0; + interpolationRestart = 2; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + }; - class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; - speed = 0; - ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01}; - looped = 1; - }; + class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; + speed = 0; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01}; + looped = 1; + }; - class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { - actions = "CivilStandActions"; - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; - ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { + actions = "CivilStandActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; + ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + }; }; - }; }; /* player playMove "ACE_AmovPercMstpScapWnonDnon"; player switchMove "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon"; -*/ + */ /*class CfgMovesBasic; class CfgMovesMaleSdr: CfgMovesBasic { - class States { +class States { class CutSceneAnimationBase; class AmovPercMstpSnonWnonDnon_EaseIn: CutSceneAnimationBase { - head = "headDefault"; - static = 1; - disableWeapons = 0; - forceAim = 0; - InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseOut",0.02,"Unconscious",0.1}; + head = "headDefault"; + static = 1; + disableWeapons = 0; + forceAim = 0; + InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseOut",0.02,"Unconscious",0.1}; }; class AmovPercMstpSnonWnonDnon_Ease: AmovPercMstpSnonWnonDnon_EaseIn { - looped = 1; - InterpolateTo[] = {"Unconscious",0.1}; + looped = 1; + InterpolateTo[] = {"Unconscious",0.1}; }; class AmovPercMstpSnonWnonDnon_EaseOut: AmovPercMstpSnonWnonDnon_EaseIn { - InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseIn",0.02,"Unconscious",0.1}; + InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseIn",0.02,"Unconscious",0.1}; }; class AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { - InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; }; class AmovPercMstpSsurWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - looped = 1; - InterpolateTo[] = {"Unconscious",0.01}; + looped = 1; + InterpolateTo[] = {"Unconscious",0.01}; }; class AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; }; - }; +}; };*/ diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index dd4f6361d7..04b8d4569f 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -5,8 +5,8 @@ class CfgVehicles { class ACE_SetCaptive { displayName = "$STR_ACE_Captives_SetCaptive"; distance = 4; - condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}); - statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3(QGVAR(SetCaptive), [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent);); + condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable [ARR_2('ACE_isCaptive', false)])}); + statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3('SetCaptive', [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent);); showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); @@ -15,8 +15,8 @@ class CfgVehicles { class ACE_ReleaseCaptive { displayName = "$STR_ACE_Captives_ReleaseCaptive"; distance = 4; - condition = QUOTE(_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}); - statement = QUOTE([ARR_2(_target, false)] call FUNC(setCaptive)); + condition = QUOTE(_target getVariable [ARR_2('ACE_isCaptive', false)] && {isNull (attachedTo _target)}); + statement = QUOTE([ARR_3('SetCaptive', [_target], [ARR_2(_target, false)])] call EFUNC(common,targetEvent);); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.4; @@ -26,7 +26,7 @@ class CfgVehicles { class ACE_EscortCaptive { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; - condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}); + condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable [ARR_2('ACE_isUnconscious', false)])}); statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; @@ -37,7 +37,7 @@ class CfgVehicles { class ACE_StopEscorting { displayName = "$STR_ACE_Captives_StopEscorting"; distance = 4; - condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {_target in (attachedObjects _player)}); + condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {_target in (attachedObjects _player)}); statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; @@ -71,8 +71,8 @@ class CfgVehicles { class ACE_SelfActions { class ACE_StopEscortingSelf { displayName = "$STR_ACE_Captives_StopEscorting"; - condition = QUOTE(((_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}); - statement = QUOTE([ARR_2((_player getVariable ['ACE_escortedUnit', objNull]), false)] call FUNC(_escortCaptive);); + condition = QUOTE(((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable [ARR_2('ACE_escortedUnit', objNull)]) in attachedObjects _player}); + statement = QUOTE([ARR_2((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]), false)] call FUNC(_escortCaptive);); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.3; diff --git a/addons/captives/CfgWeapons.hpp b/addons/captives/CfgWeapons.hpp index 3005a2fa5c..be2149ca88 100644 --- a/addons/captives/CfgWeapons.hpp +++ b/addons/captives/CfgWeapons.hpp @@ -1,15 +1,15 @@ class CfgWeapons { - class ACE_ItemCore; - class InventoryItem_Base_F; + class ACE_ItemCore; + class InventoryItem_Base_F; - class ACE_CableTie: ACE_ItemCore { - displayName = "$STR_ACE_Captives_CableTie"; - descriptionShort = "$STR_ACE_Captives_CableTieDescription"; - model = QUOTE(PATHTOF(models\ace_cabletie.p3d)); - picture = QUOTE(PATHTOF(UI\ace_cabletie_ca.paa)); - scope = 2; - class ItemInfo: InventoryItem_Base_F { - mass = 1; + class ACE_CableTie: ACE_ItemCore { + displayName = "$STR_ACE_Captives_CableTie"; + descriptionShort = "$STR_ACE_Captives_CableTieDescription"; + model = QUOTE(PATHTOF(models\ace_cabletie.p3d)); + picture = QUOTE(PATHTOF(UI\ace_cabletie_ca.paa)); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + }; }; - }; }; diff --git a/addons/captives/README.md b/addons/captives/README.md new file mode 100644 index 0000000000..3938720f08 --- /dev/null +++ b/addons/captives/README.md @@ -0,0 +1,14 @@ +ace_captives +============ + +Allows taking people captive/handcuffed + +####Items: +`ACE_CableTie` - adds ability to take someone captive + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [PabstMirror](https://github.com/PabstMirror) diff --git a/addons/captives/XEH_postInitClient.sqf b/addons/captives/XEH_postInitClient.sqf index a461b36aeb..ccec1d39d2 100644 --- a/addons/captives/XEH_postInitClient.sqf +++ b/addons/captives/XEH_postInitClient.sqf @@ -1,9 +1,19 @@ -// by commy2 +#include "script_component.hpp" [missionNamespace, "playerChanged", {_this call ACE_Captives_fnc_handlePlayerChanged}] call ACE_Core_fnc_addCustomEventhandler; -[QGVAR(MoveIn), {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); -[QGVAR(MoveOut), {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); -[QGVAR(SetCaptive), {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); +["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +["SetCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); + +//TODO: Medical Integration Events??? + +// [_unit, "knockedOut", { + // if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; +// }] call ACE_Core_fnc_addCustomEventhandler; + +// [_unit, "wokeUp", { + // if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; +// }] call ACE_Core_fnc_addCustomEventhandler; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 7f83ce4fad..505d57051e 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -17,5 +17,7 @@ PREP(openFriskMenu); PREP(setCaptive); PREP(surrender); PREP(unloadCaptive); +PREP(vehicleCaptiveMoveIn); +PREP(vehicleCaptiveMoveOut); ADDON = true; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index fea03cfe16..f23e380dd3 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -19,7 +19,7 @@ PARAMS_2(_unit,_oldUnit); if (_unit getVariable ["ACE_isCaptive", false]) then { - showHUD false; + showHUD false; } else { - showHUD true; + showHUD true; }; diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf index cbcd2a07ae..ea6a1bcb26 100644 --- a/addons/captives/functions/fnc_handleWokeUp.sqf +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -18,6 +18,6 @@ PARAMS_1(_unit); if (_unit getVariable ["ACE_isCaptive", false] && {vehicle _unit == _unit}) then { - [_unit] call EFUNC(common,fixLoweredRifleAnimation); - [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_initPost.sqf b/addons/captives/functions/fnc_initPost.sqf index 5c116be417..8e777a9717 100644 --- a/addons/captives/functions/fnc_initPost.sqf +++ b/addons/captives/functions/fnc_initPost.sqf @@ -19,6 +19,6 @@ PARAMS_1(_unit); // reset status on mission start if (_unit getVariable ["ACE_isCaptive", false]) then { - _unit setVariable ["ACE_isCaptive", false]; - [_unit, true] call ACE_Captives_fnc_setCaptive; + _unit setVariable ["ACE_isCaptive", false]; + [_unit, true] call ACE_Captives_fnc_setCaptive; }; diff --git a/addons/captives/functions/fnc_initUnit.sqf b/addons/captives/functions/fnc_initUnit.sqf index 13777dca1d..df9356ff2a 100644 --- a/addons/captives/functions/fnc_initUnit.sqf +++ b/addons/captives/functions/fnc_initUnit.sqf @@ -17,13 +17,6 @@ PARAMS_1(_unit); -[_unit, "knockedOut", { - if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; -}] call ACE_Core_fnc_addCustomEventhandler; - -[_unit, "wokeUp", { - if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; -}] call ACE_Core_fnc_addCustomEventhandler; // prevent players from throwing grenades -[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call ACE_Core_fnc_addActionEventhandler; +[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler); diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_loadCaptive.sqf index 2648255c3b..05f87a20c6 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_loadCaptive.sqf @@ -17,7 +17,7 @@ */ #include "script_component.hpp" -PARAMS_1(_unit,_target,_vehicle); +PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; @@ -32,5 +32,5 @@ if (isNull _vehicle) then { if ((!isNil "_target") && {!isNil "_vehicle"}) then { _unit setVariable ["ACE_isEscorting", false]; - [QGVAR(MoveIn), [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); + ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); }; diff --git a/addons/captives/functions/fnc_openFriskMenu.sqf b/addons/captives/functions/fnc_openFriskMenu.sqf index 42dda4ab66..d69dbd045c 100644 --- a/addons/captives/functions/fnc_openFriskMenu.sqf +++ b/addons/captives/functions/fnc_openFriskMenu.sqf @@ -22,7 +22,7 @@ PARAMS_2(_player,_unit); _weapon = currentWeapon _player; if (_weapon == primaryWeapon _player && {_weapon != ""}) then { - [_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation); + [_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation); }; _listedItemClasses = []; @@ -32,19 +32,19 @@ _actions = [localize "STR_ACE_Captives_FriskMenuHeader", localize "STR_ACE_Capti _allGear = []; if ((handgunWeapon _unit) != "") then { - _allGear pushBack (handgunWeapon _unit); + _allGear pushBack (handgunWeapon _unit); }; if (count (uniformItems _unit) > 0) then { - _allGear = _allGear + (uniformItems _unit); + _allGear = _allGear + (uniformItems _unit); }; if (count (vestItems _unit) > 0) then { - _allGear = _allGear + (vestItems _unit); + _allGear = _allGear + (vestItems _unit); }; if (count (backpackItems _unit) > 0) then { - _allGear = _allGear + (backpackItems _unit); + _allGear = _allGear + (backpackItems _unit); }; if (count (assignedItems _unit) > 0) then { - _allGear = _allGear + (assignedItems _unit); + _allGear = _allGear + (assignedItems _unit); }; // Handgun @@ -53,15 +53,15 @@ if (count (assignedItems _unit) > 0) then { // Backpack Items // Assigned Items { - if (!(_x in _listedItemClasses)) then { - private "_item"; - _item = configFile >> "CfgMagazines" >> _x; - if (isNil "_item" || str _item == "") then { //str _item ? - _item = configFile >> "CfgWeapons" >> _x; + if (!(_x in _listedItemClasses)) then { + private "_item"; + _item = configFile >> "CfgMagazines" >> _x; + if (isNil "_item" || str _item == "") then { //str _item ? + _item = configFile >> "CfgWeapons" >> _x; + }; + _actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call ACE_Interaction_fnc_addSelectableItem; + _listedItemClasses pushBack _x; }; - _actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call ACE_Interaction_fnc_addSelectableItem; - _listedItemClasses pushBack _x; - }; } forEach (_allGear); [_actions, {call ACE_Interaction_fnc_hideMenu;}, {call ACE_Interaction_fnc_hideMenu;}] call ACE_Interaction_fnc_openSelectMenu; diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index b308775040..92f0ea416a 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -21,43 +21,43 @@ PARAMS_2(_unit,_state); if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["ACE_isSurrender", false]) exitWith {}; + if (_unit getVariable ["ACE_isSurrender", false]) exitWith {}; - _unit setVariable ["ACE_isSurrender", true, true]; - [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; + _unit setVariable ["ACE_isSurrender", true, true]; + [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; - _unit spawn { - // fix for lowered rifle animation glitch - if (currentWeapon _this != "" && {currentWeapon _this == primaryWeapon _this} && {weaponLowered _this} && {stance _this == "STAND"}) then { - _this playMove "amovpercmstpsraswrfldnon"; + _unit spawn { + // fix for lowered rifle animation glitch + if (currentWeapon _this != "" && {currentWeapon _this == primaryWeapon _this} && {weaponLowered _this} && {stance _this == "STAND"}) then { + _this playMove "amovpercmstpsraswrfldnon"; + }; + + while {_this getVariable ["ACE_isSurrender", false]} do { + sleep 0.001; //sleep in UI + + if (isPlayer _this) then {showHUD false}; + + if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { + _this setVariable ["ACE_isSurrender", false, true]; + } else { + _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; + }; + }; + if !(_this getVariable ["ACE_isUnconscious", false]) then { + _this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; + } else { + _this playMoveNow "unconscious"; + }; + + [_this, "ACE_Surrendered", false] call ACE_Core_fnc_setCaptivityStatus; + + if (isPlayer _this) then {showHUD true}; }; - - while {_this getVariable ["ACE_isSurrender", false]} do { - sleep 0.001; //sleep in UI - - if (isPlayer _this) then {showHUD false}; - - if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { - _this setVariable ["ACE_isSurrender", false, true]; - } else { - _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; - }; - }; - if !(_this getVariable ["ACE_isUnconscious", false]) then { - _this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; - } else { - _this playMoveNow "unconscious"; - }; - - [_this, "ACE_Surrendered", false] call ACE_Core_fnc_setCaptivityStatus; - - if (isPlayer _this) then {showHUD true}; - }; } else { - _unit setVariable ["ACE_isSurrender", false, true]; + _unit setVariable ["ACE_isSurrender", false, true]; }; /* player playMove "AmovPercMstpSsurWnonDnon" player switchMove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon" -*/ + */ diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_unloadCaptive.sqf index 2ede9de480..057b825d12 100644 --- a/addons/captives/functions/fnc_unloadCaptive.sqf +++ b/addons/captives/functions/fnc_unloadCaptive.sqf @@ -26,7 +26,7 @@ _cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(commo if ((count _cargo) > 0) then { _target = _cargo select 0; - [QGVAR(MoveOut), [_target], [_target]] call EFUNC(common,targetEvent); + ["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent); } else { ERROR("No captive to unload"); }; diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf index 1eb1c2ef2b..fe4d0528c6 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -20,8 +20,8 @@ PARAMS_2(_target,_vehicle); private ["_cargoIndex"]; -_target moveInCargo _vehicle; -_target assignAsCargo _vehicle; +_target moveInCargo _vehicle; +_target assignAsCargo _vehicle; _cargoIndex = _vehicle getCargoIndex _target; _target setVariable ["ACE_Captives_CargoIndex", _cargoIndex, true]; From 11cd426b87162ad710e07d28566e69d24c0ef938 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 4 Feb 2015 00:35:51 -0600 Subject: [PATCH 06/16] Redo XEH --- addons/captives/CfgEventHandlers.hpp | 15 ++-------- addons/captives/XEH_preInit.sqf | 5 ++-- addons/captives/config.cpp | 10 +++---- addons/captives/functions/fnc_handleGetIn.sqf | 24 +++++++++++++++ .../captives/functions/fnc_handleGetOut.sqf | 18 ++++++------ .../captives/functions/fnc_handleKilled.sqf | 26 +++++++++++++++++ .../functions/fnc_handleUnitInitPost.sqf | 29 +++++++++++++++++++ addons/captives/functions/fnc_initPost.sqf | 24 --------------- addons/captives/functions/fnc_initUnit.sqf | 22 -------------- addons/captives/functions/fnc_loadCaptive.sqf | 2 +- 10 files changed, 100 insertions(+), 75 deletions(-) create mode 100644 addons/captives/functions/fnc_handleGetIn.sqf create mode 100644 addons/captives/functions/fnc_handleKilled.sqf create mode 100644 addons/captives/functions/fnc_handleUnitInitPost.sqf delete mode 100644 addons/captives/functions/fnc_initPost.sqf delete mode 100644 addons/captives/functions/fnc_initUnit.sqf diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index b8c182d1f6..07dbe45fb7 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -14,7 +14,7 @@ class Extended_PostInit_EventHandlers { class Extended_GetIn_EventHandlers { class All { class GVAR(AutoDetachCaptive) { - getIn = "if (local (_this select 2) && {(_this select 2) getVariable ['ACE_isEscorting', false]}) then {(_this select 2) setVariable ['ACE_isEscorting', false, true]}"; + getIn = QUOTE(_this call FUNC(handleGetIn)); }; }; }; @@ -32,16 +32,7 @@ class Extended_GetOut_EventHandlers { class Extended_Killed_EventHandlers { class CAManBase { class GVAR(AutoDetachCaptive) { - killed = "if ((_this select 0) getVariable ['ACE_isCaptive', false]) then {(_this select 0) setVariable ['ACE_isCaptive', false, true]}; if ((_this select 0) getVariable ['ACE_isEscorting', false]) then {(_this select 0) setVariable ['ACE_isEscorting', false, true]};"; - }; - }; -}; - -//handle captive and unconsciousness state -class Extended_Init_EventHandlers { - class CAManBase { - class GVAR(AutoDetachCaptive) { - init = "_this call ACE_Captives_fnc_initUnit"; + killed = QUOTE(_this call FUNC(handleKilled)); }; }; }; @@ -50,7 +41,7 @@ class Extended_Init_EventHandlers { class Extended_InitPost_EventHandlers { class CAManBase { class GVAR(InitPost) { - init = "if (local (_this select 0)) then {_this call ACE_Captives_fnc_initPost};"; + init = QUOTE(_this call FUNC(handleUnitInitPost)); }; }; }; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 505d57051e..5ff2379c0b 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -6,12 +6,13 @@ PREP(canFriskPerson); PREP(canLoadCaptive); PREP(canUnloadCaptive); PREP(escortCaptive); +PREP(handleGetIn); PREP(handleGetOut); +PREP(handleKilled); PREP(handleKnockedOut); PREP(handlePlayerChanged); PREP(handleWokeUp); -PREP(initPost); -PREP(initUnit); +PREP(handleUnitInitPost); PREP(loadCaptive); PREP(openFriskMenu); PREP(setCaptive); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index 7e5c3382bb..7bef039e37 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -18,14 +18,14 @@ class CfgPatches { #include "CfgWeapons.hpp" -class ACE_Core_canInteractConditions { - class ACE_Interaction_isNotEscorting { - condition = "!(_player getVariable ['ACE_isEscorting', false])"; +class ACE_canInteractConditions { + class GVAR(isNotEscorting) { + condition = QUOTE(!(_player getVariable ['ACE_isEscorting', false])"; }; - class ACE_Interaction_isNotCaptive { + class GVAR(isNotCaptive) { condition = "!(_player getVariable ['ACE_isCaptive', false])"; }; - class ACE_Interaction_isNotSurrendering { + class GVAR(isNotSurrendering) { condition = "!(_player getVariable ['ACE_isSurrender', false])"; }; }; diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf new file mode 100644 index 0000000000..dc0b5aa5af --- /dev/null +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * Handles when a unit gets in to a vehicle. Release escorted captive when entering a vehicle + * + * Arguments: + * 0: _vehicle + * 2: dunno + * 1: _unit + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_vehicle,_dontcare,_unit); + +if ((local _unit) && (_unit getVariable ["ACE_isEscorting", false])) then { + _unit setVariable ["ACE_isEscorting", false, true]; +}; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index f734fa0177..82e6417eab 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -19,16 +19,16 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if (!local _unit) exitWith {}; -if (!(_unit getVariable ["ACE_isCaptive", false])) exitWith {}; +if ((local _unit)&&(_unit getVariable ["ACE_isCaptive", false])) then { -private ["_cargoIndex"]; + private ["_cargoIndex"]; -_cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; + _cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; -//If captive was not "unloaded", then move them back into the vehicle. -if (_cargoIndex != -1) exitWith { - _unit moveInCargo [_vehicle, _cargoIndex]; -}; + //If captive was not "unloaded", then move them back into the vehicle. + if (_cargoIndex != -1) exitWith { + _unit moveInCargo [_vehicle, _cargoIndex]; + }; -[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); +}; \ No newline at end of file diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..2d476f662c --- /dev/null +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -0,0 +1,26 @@ +/* + * Author: PabstMirror + * Handles when a unit is kill. Reset captivity and escorting status when getting killed + * + * Arguments: + * 0: _oldUnit + * + * Return Value: + * None + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_oldUnit); + +if (_oldUnit getVariable ["ACE_isCaptive", false]) then { + _oldUnit setVariable ["ACE_isCaptive", false, true]; +}; + +if (_oldUnit getVariable ["ACE_isEscorting", false]) then { + _oldUnit setVariable ["ACE_isEscorting", false, true] +}; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf new file mode 100644 index 0000000000..97362b1b96 --- /dev/null +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -0,0 +1,29 @@ +/* +* Author: commy2 +* handle captive and unconsciousness state and prevent grenades +* +* Arguments: +* 0: _unit +* +* Return Value: +* The return value +* +* Example: +* TODO +* +* Public: No +*/ +#include "script_component.hpp" + +PARAMS_1(_unit); + +// prevent players from throwing grenades +[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler); + +if (local _unit) then { + // reset status on mission start + if (_unit getVariable ["ACE_isCaptive", false]) then { + _unit setVariable ["ACE_isCaptive", false]; + [_unit, true] call FUNC(setCaptive); + }; +}; diff --git a/addons/captives/functions/fnc_initPost.sqf b/addons/captives/functions/fnc_initPost.sqf deleted file mode 100644 index 8e777a9717..0000000000 --- a/addons/captives/functions/fnc_initPost.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Author: commy2 - * TODO - * - * Arguments: - * 0: _unit - * - * Return Value: - * The return value - * - * Example: - * TODO - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_1(_unit); - -// reset status on mission start -if (_unit getVariable ["ACE_isCaptive", false]) then { - _unit setVariable ["ACE_isCaptive", false]; - [_unit, true] call ACE_Captives_fnc_setCaptive; -}; diff --git a/addons/captives/functions/fnc_initUnit.sqf b/addons/captives/functions/fnc_initUnit.sqf deleted file mode 100644 index df9356ff2a..0000000000 --- a/addons/captives/functions/fnc_initUnit.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: commy2 - * TODO - * - * Arguments: - * 0: _unit - * - * Return Value: - * The return value - * - * Example: - * TODO - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_1(_unit); - - -// prevent players from throwing grenades -[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler); diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_loadCaptive.sqf index 05f87a20c6..680fee343c 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_loadCaptive.sqf @@ -31,6 +31,6 @@ if (isNull _vehicle) then { }; if ((!isNil "_target") && {!isNil "_vehicle"}) then { - _unit setVariable ["ACE_isEscorting", false]; + _unit setVariable ["ACE_isEscorting", false, true]; ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); }; From 435b3b8b867922ddc0c6ac5ee4d3700809e714ca Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 4 Feb 2015 13:16:19 -0600 Subject: [PATCH 07/16] Move Code out of CfgVehicles --- addons/captives/CfgVehicles.hpp | 20 +++---- addons/captives/XEH_preInit.sqf | 16 ++++-- addons/captives/config.cpp | 8 ++- .../functions/fnc_canEscortCaptive.sqf | 24 ++++++++ .../captives/functions/fnc_canFriskPerson.sqf | 2 +- .../captives/functions/fnc_canLoadCaptive.sqf | 4 +- .../functions/fnc_canReleaseCaptive.sqf | 23 ++++++++ .../functions/fnc_canStopEscorting.sqf | 41 ++++++++++++++ .../captives/functions/fnc_canTakeCaptive.sqf | 23 ++++++++ .../functions/fnc_canUnloadCaptive.sqf | 2 +- .../functions/fnc_doEscortCaptive.sqf | 56 +++++++++++++++++++ ...penFriskMenu.sqf => fnc_doFriskPerson.sqf} | 0 ..._loadCaptive.sqf => fnc_doLoadCaptive.sqf} | 4 +- .../functions/fnc_doReleaseCaptive.sqf | 21 +++++++ .../captives/functions/fnc_doTakeCaptive.sqf | 22 ++++++++ ...oadCaptive.sqf => fnc_doUnloadCaptive.sqf} | 2 +- .../captives/functions/fnc_escortCaptive.sqf | 55 ------------------ addons/captives/functions/fnc_handleGetIn.sqf | 4 +- .../captives/functions/fnc_handleGetOut.sqf | 2 +- .../captives/functions/fnc_handleKilled.sqf | 8 +-- .../functions/fnc_handlePlayerChanged.sqf | 2 +- .../functions/fnc_handleUnitInitPost.sqf | 6 +- .../captives/functions/fnc_handleWokeUp.sqf | 2 +- addons/captives/functions/fnc_setCaptive.sqf | 10 ++-- addons/captives/functions/fnc_surrender.sqf | 10 ++-- addons/interaction/config.cpp | 9 --- 26 files changed, 265 insertions(+), 111 deletions(-) create mode 100644 addons/captives/functions/fnc_canEscortCaptive.sqf create mode 100644 addons/captives/functions/fnc_canReleaseCaptive.sqf create mode 100644 addons/captives/functions/fnc_canStopEscorting.sqf create mode 100644 addons/captives/functions/fnc_canTakeCaptive.sqf create mode 100644 addons/captives/functions/fnc_doEscortCaptive.sqf rename addons/captives/functions/{fnc_openFriskMenu.sqf => fnc_doFriskPerson.sqf} (100%) rename addons/captives/functions/{fnc_loadCaptive.sqf => fnc_doLoadCaptive.sqf} (84%) create mode 100644 addons/captives/functions/fnc_doReleaseCaptive.sqf create mode 100644 addons/captives/functions/fnc_doTakeCaptive.sqf rename addons/captives/functions/{fnc_unloadCaptive.sqf => fnc_doUnloadCaptive.sqf} (87%) delete mode 100644 addons/captives/functions/fnc_escortCaptive.sqf diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 04b8d4569f..059b07cfb8 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -5,8 +5,8 @@ class CfgVehicles { class ACE_SetCaptive { displayName = "$STR_ACE_Captives_SetCaptive"; distance = 4; - condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable [ARR_2('ACE_isCaptive', false)])}); - statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3('SetCaptive', [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent);); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canTakeCaptive)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doTakeCaptive)); showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); @@ -15,8 +15,8 @@ class CfgVehicles { class ACE_ReleaseCaptive { displayName = "$STR_ACE_Captives_ReleaseCaptive"; distance = 4; - condition = QUOTE(_target getVariable [ARR_2('ACE_isCaptive', false)] && {isNull (attachedTo _target)}); - statement = QUOTE([ARR_3('SetCaptive', [_target], [ARR_2(_target, false)])] call EFUNC(common,targetEvent);); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canReleaseCaptive)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doReleaseCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.4; @@ -26,8 +26,8 @@ class CfgVehicles { class ACE_EscortCaptive { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; - condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable [ARR_2('ACE_isUnconscious', false)])}); - statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive)); + statement = QUOTE([ARR_2(_target, true)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); @@ -37,8 +37,8 @@ class CfgVehicles { class ACE_StopEscorting { displayName = "$STR_ACE_Captives_StopEscorting"; distance = 4; - condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {_target in (attachedObjects _player)}); - statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting)); + statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); @@ -71,8 +71,8 @@ class CfgVehicles { class ACE_SelfActions { class ACE_StopEscortingSelf { displayName = "$STR_ACE_Captives_StopEscorting"; - condition = QUOTE(((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable [ARR_2('ACE_escortedUnit', objNull)]) in attachedObjects _player}); - statement = QUOTE([ARR_2((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]), false)] call FUNC(_escortCaptive);); + condition = QUOTE([ARR_2(_player, objNull)] call FUNC(canStopEscorting)); + statement = QUOTE([ARR_3(_player,objNull, false)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.3; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 5ff2379c0b..b3de41ae69 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -2,22 +2,28 @@ ADDON = false; +PREP(canEscortCaptive); PREP(canFriskPerson); PREP(canLoadCaptive); +PREP(canReleaseCaptive); +PREP(canStopEscorting); +PREP(canTakeCaptive); PREP(canUnloadCaptive); -PREP(escortCaptive); +PREP(doEscortCaptive); +PREP(doFriskPerson); +PREP(doLoadCaptive); +PREP(doReleaseCaptive); +PREP(doTakeCaptive); +PREP(doUnloadCaptive); PREP(handleGetIn); PREP(handleGetOut); PREP(handleKilled); PREP(handleKnockedOut); PREP(handlePlayerChanged); -PREP(handleWokeUp); PREP(handleUnitInitPost); -PREP(loadCaptive); -PREP(openFriskMenu); +PREP(handleWokeUp); PREP(setCaptive); PREP(surrender); -PREP(unloadCaptive); PREP(vehicleCaptiveMoveIn); PREP(vehicleCaptiveMoveOut); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index 7bef039e37..d7cb36371d 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -17,15 +17,17 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#define GVARFIX(var1) getVariable [ARR_2(QUOTE(GVAR(var1)), false)] + class ACE_canInteractConditions { class GVAR(isNotEscorting) { - condition = QUOTE(!(_player getVariable ['ACE_isEscorting', false])"; + condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false))); }; class GVAR(isNotCaptive) { - condition = "!(_player getVariable ['ACE_isCaptive', false])"; + condition = QUOTE(!(GETVAR(player,QGVAR(isCaptive),false))); }; class GVAR(isNotSurrendering) { - condition = "!(_player getVariable ['ACE_isSurrender', false])"; + condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false))); }; }; diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf new file mode 100644 index 0000000000..40a3e0d560 --- /dev/null +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -0,0 +1,24 @@ +/* + * Author: PabstMirror + * Tests if can escort target (attach) + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +(_target getVariable [QGVAR(isCaptive), false]) && +{isNull (attachedTo _target)} && +{alive _target} && +{!(_target getVariable [QGVAR(ACE_isUnconscious), false])} diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf index 62d5a06742..6ee44b2af5 100644 --- a/addons/captives/functions/fnc_canFriskPerson.sqf +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -18,6 +18,6 @@ PARAMS_2(_unit,_target); -_target getVariable ["ACE_isCaptive", false] +_target getVariable [QGVAR(isCaptive), false] || {_target getVariable ["ACE_isSearchable", false]} || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index b8021e602f..a05765b195 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -23,7 +23,7 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + _objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); _target = _objects select 0; }; @@ -32,7 +32,7 @@ if (isNull _vehicle) then { _vehicle = _objects select 0; }; -_unit getVariable ["ACE_isEscorting", false] +_unit getVariable [QGVAR(isEscorting), false] && {!isNil "_target"} && {!isNil "_vehicle"} && {_vehicle emptyPositions "cargo" > 0} diff --git a/addons/captives/functions/fnc_canReleaseCaptive.sqf b/addons/captives/functions/fnc_canReleaseCaptive.sqf new file mode 100644 index 0000000000..50b4c55310 --- /dev/null +++ b/addons/captives/functions/fnc_canReleaseCaptive.sqf @@ -0,0 +1,23 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to release a captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +//Unit is captive and not being escorted +_target getVariable [QGVAR(isCaptive), false] && +{isNull (attachedTo _target)} diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf new file mode 100644 index 0000000000..4f30e7a82a --- /dev/null +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -0,0 +1,41 @@ +/* + * Author: PabstMirror + * Tests if player can stop escorting + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); +DEFAULT_PARAM(1,_target,objNull); + +private ["_isAttached"]; + + +if (isNull _target) then { + _target = _unit getVariable ["ACE_escortedUnit", objNull]; +}; + +if (isNull _target) exitWith { + ERROR("Null Target (no ACE_escortedUnit)"); + false +}; + +_isAttached = _target in (attachedObjects _unit); + +if (_isAttached && (!(_target getVariable [QGVAR(isCaptive), false]))) exitWith { + ERROR("Attached But Not Captive"); + false +}; + +_isAttached diff --git a/addons/captives/functions/fnc_canTakeCaptive.sqf b/addons/captives/functions/fnc_canTakeCaptive.sqf new file mode 100644 index 0000000000..f67f6110bf --- /dev/null +++ b/addons/captives/functions/fnc_canTakeCaptive.sqf @@ -0,0 +1,23 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to take a unit captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +("ACE_CableTie" in (items _unit)) && +{alive _target} && +{!(_target getVariable [QGVAR(isCaptive), false])} diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf index b714ebc8ae..1aef4602e1 100644 --- a/addons/captives/functions/fnc_canUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -23,6 +23,6 @@ PARAMS_2(_unit,_vehicle); _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. -_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); +_cargo = [_cargo, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); count _cargo > 0 diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf new file mode 100644 index 0000000000..05dc912205 --- /dev/null +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -0,0 +1,56 @@ +/* + * Author: Nic547 + * Attaches a Captive to the _unit + * + * Arguments: + * 0: _unit-Player + * 1: target + * 2: _state + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_unit,_target,_state); + +if !("ACE_Handcuffed" in ([_target] call ACE_Core_fnc_getCaptivityStatus)) exitWith { + [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); +}; + +if (_state) then { + if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {}; + + [_unit, _target] call EFUNC(common,claim); + _unit setVariable [QGVAR(isEscorting), true, true]; + + _target attachTo [_unit, [0, 1, 0]]; + + _unit setVariable ["ACE_escortedUnit", _target, true]; + _actionID = _unit addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], "[_unit getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (_unit getVariable ['ACE_escortedUnit', objNull])"]; + + [_target, _actionID] spawn { + _target = _this select 0; + _actionID = _this select 1; + + while {_unit getVariable [QGVAR(isEscorting), false]} do { + sleep 0.2; + + if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { + _unit setVariable [QGVAR(isEscorting), false, true]; + }; + }; + [objNull, _target] call EFUNC(common,claim); + + detach _target; + _unit removeAction _actionID; + }; +} else { + _unit setVariable [QGVAR(isEscorting), false, true]; + _unit setVariable ["ACE_escortedUnit", objNull, true]; +}; diff --git a/addons/captives/functions/fnc_openFriskMenu.sqf b/addons/captives/functions/fnc_doFriskPerson.sqf similarity index 100% rename from addons/captives/functions/fnc_openFriskMenu.sqf rename to addons/captives/functions/fnc_doFriskPerson.sqf diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf similarity index 84% rename from addons/captives/functions/fnc_loadCaptive.sqf rename to addons/captives/functions/fnc_doLoadCaptive.sqf index 680fee343c..1ef650b4ee 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -21,7 +21,7 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + _objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); _target = _objects select 0; }; @@ -31,6 +31,6 @@ if (isNull _vehicle) then { }; if ((!isNil "_target") && {!isNil "_vehicle"}) then { - _unit setVariable ["ACE_isEscorting", false, true]; + _unit setVariable [QGVAR(isEscorting), false, true]; ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); }; diff --git a/addons/captives/functions/fnc_doReleaseCaptive.sqf b/addons/captives/functions/fnc_doReleaseCaptive.sqf new file mode 100644 index 0000000000..a807959565 --- /dev/null +++ b/addons/captives/functions/fnc_doReleaseCaptive.sqf @@ -0,0 +1,21 @@ +/* + * Author: PabstMirror + * Release a captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +["SetCaptive", [_target], [_target, false]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doTakeCaptive.sqf b/addons/captives/functions/fnc_doTakeCaptive.sqf new file mode 100644 index 0000000000..8deb712d09 --- /dev/null +++ b/addons/captives/functions/fnc_doTakeCaptive.sqf @@ -0,0 +1,22 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to take a unit captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +_unit removeItem 'ACE_CableTie'; +["SetCaptive", [_target], [_target, true]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_doUnloadCaptive.sqf similarity index 87% rename from addons/captives/functions/fnc_unloadCaptive.sqf rename to addons/captives/functions/fnc_doUnloadCaptive.sqf index 057b825d12..1a6b6a2d0c 100644 --- a/addons/captives/functions/fnc_unloadCaptive.sqf +++ b/addons/captives/functions/fnc_doUnloadCaptive.sqf @@ -22,7 +22,7 @@ private ["_cargo", "_target"]; _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. -_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); +_cargo = [_cargo, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); if ((count _cargo) > 0) then { _target = _cargo select 0; diff --git a/addons/captives/functions/fnc_escortCaptive.sqf b/addons/captives/functions/fnc_escortCaptive.sqf deleted file mode 100644 index c3030a9d33..0000000000 --- a/addons/captives/functions/fnc_escortCaptive.sqf +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: Nic547 - * Attaches a Captive to the player - * - * Arguments: - * 0: _unit - * 1: _state - * - * Return Value: - * The return value - * - * Example: - * - - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_2(_unit,_state); - -if !("ACE_Handcuffed" in ([_unit] call ACE_Core_fnc_getCaptivityStatus)) exitWith { - [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); -}; - -if (_state) then { - if (player getVariable ["ACE_isEscorting", false]) exitWith {}; - - [player, _unit] call EFUNC(common,claim); - player setVariable ["ACE_isEscorting", true, true]; - - _unit attachTo [player, [0, 1, 0]]; - - player setVariable ["ACE_escortedUnit", _unit, true]; - _actionID = player addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], "[player getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (player getVariable ['ACE_escortedUnit', objNull])"]; - - [_unit, _actionID] spawn { - _unit = _this select 0; - _actionID = _this select 1; - - while {player getVariable ["ACE_isEscorting", false]} do { - sleep 0.2; - - if (!alive _unit || {!alive player} || {!canStand _unit} || {!canStand player} || {_unit getVariable ["ACE_isUnconscious", false]} || {player getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo player)}) then { - player setVariable ["ACE_isEscorting", false, true]; - }; - }; - [objNull, _unit] call EFUNC(common,claim); - - detach _unit; - player removeAction _actionID; - }; -} else { - player setVariable ["ACE_isEscorting", false, true]; - player setVariable ["ACE_escortedUnit", objNull, true]; -}; diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf index dc0b5aa5af..eb3a9ad8b1 100644 --- a/addons/captives/functions/fnc_handleGetIn.sqf +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -19,6 +19,6 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if ((local _unit) && (_unit getVariable ["ACE_isEscorting", false])) then { - _unit setVariable ["ACE_isEscorting", false, true]; +if ((local _unit) && (_unit getVariable [QGVAR(isEscorting), false])) then { + _unit setVariable [QGVAR(isEscorting), false, true]; }; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index 82e6417eab..84c856ed39 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -19,7 +19,7 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if ((local _unit)&&(_unit getVariable ["ACE_isCaptive", false])) then { +if ((local _unit)&&(_unit getVariable [QGVAR(isCaptive), false])) then { private ["_cargoIndex"]; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf index 2d476f662c..6e41fa801a 100644 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -17,10 +17,10 @@ PARAMS_1(_oldUnit); -if (_oldUnit getVariable ["ACE_isCaptive", false]) then { - _oldUnit setVariable ["ACE_isCaptive", false, true]; +if (_oldUnit getVariable [QGVAR(isCaptive), false]) then { + _oldUnit setVariable [QGVAR(isCaptive), false, true]; }; -if (_oldUnit getVariable ["ACE_isEscorting", false]) then { - _oldUnit setVariable ["ACE_isEscorting", false, true] +if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { + _oldUnit setVariable [QGVAR(isEscorting), false, true] }; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index f23e380dd3..d7efa70a5f 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -18,7 +18,7 @@ PARAMS_2(_unit,_oldUnit); -if (_unit getVariable ["ACE_isCaptive", false]) then { +if (_unit getVariable [QGVAR(isCaptive), false]) then { showHUD false; } else { showHUD true; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index 97362b1b96..a0e76c0a10 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -18,12 +18,12 @@ PARAMS_1(_unit); // prevent players from throwing grenades -[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler); +[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isCaptive), false]}, {}] call EFUNC(common,addActionEventhandler); if (local _unit) then { // reset status on mission start - if (_unit getVariable ["ACE_isCaptive", false]) then { - _unit setVariable ["ACE_isCaptive", false]; + if (_unit getVariable [QGVAR(isCaptive), false]) then { + _unit setVariable [QGVAR(isCaptive), false]; [_unit, true] call FUNC(setCaptive); }; }; diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf index ea6a1bcb26..2973aa7f83 100644 --- a/addons/captives/functions/fnc_handleWokeUp.sqf +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -17,7 +17,7 @@ PARAMS_1(_unit); -if (_unit getVariable ["ACE_isCaptive", false] && {vehicle _unit == _unit}) then { +if (_unit getVariable [QGVAR(isCaptive), false] && {vehicle _unit == _unit}) then { [_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_setCaptive.sqf b/addons/captives/functions/fnc_setCaptive.sqf index b4c047dd1b..eca34b3bac 100644 --- a/addons/captives/functions/fnc_setCaptive.sqf +++ b/addons/captives/functions/fnc_setCaptive.sqf @@ -21,15 +21,15 @@ PARAMS_2(_unit,_state); if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + if (_unit getVariable [QGVAR(isCaptive), false]) exitWith {}; - _unit setVariable ["ACE_isCaptive", true, true]; + _unit setVariable [QGVAR(isCaptive), true, true]; // fix anim on mission start (should work on dedicated servers) _unit spawn { [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; - if (_this getVariable ["ACE_isCaptive", false] && {vehicle _this == _this}) then { + if (_this getVariable [QGVAR(isCaptive), false] && {vehicle _this == _this}) then { [_this] call EFUNC(common,fixLoweredRifleAnimation); [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); }; @@ -41,9 +41,9 @@ if (_state) then { showHUD false; }; } else { - if !(_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + if !(_unit getVariable [QGVAR(isCaptive), false]) exitWith {}; - _unit setVariable ["ACE_isCaptive", false, true]; + _unit setVariable [QGVAR(isCaptive), false, true]; [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; if (vehicle _unit == _unit) then { [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 92f0ea416a..3d3b65ec49 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -21,9 +21,9 @@ PARAMS_2(_unit,_state); if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["ACE_isSurrender", false]) exitWith {}; + if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {}; - _unit setVariable ["ACE_isSurrender", true, true]; + _unit setVariable [QGVAR(isSurrender), true, true]; [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; _unit spawn { @@ -32,13 +32,13 @@ if (_state) then { _this playMove "amovpercmstpsraswrfldnon"; }; - while {_this getVariable ["ACE_isSurrender", false]} do { + while {_this getVariable [QGVAR(isSurrender), false]} do { sleep 0.001; //sleep in UI if (isPlayer _this) then {showHUD false}; if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { - _this setVariable ["ACE_isSurrender", false, true]; + _this setVariable [QGVAR(isSurrender), false, true]; } else { _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; }; @@ -54,7 +54,7 @@ if (_state) then { if (isPlayer _this) then {showHUD true}; }; } else { - _unit setVariable ["ACE_isSurrender", false, true]; + _unit setVariable [QGVAR(isSurrender), false, true]; }; /* diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index acb41d362f..3b53855eef 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -38,15 +38,6 @@ class ACE_Parameters_Boolean { }; class ACE_canInteractConditions { - class GVAR(isNotEscorting) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isEscorting', false)]) ); - }; - class GVAR(isNotCaptive) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isCaptive', false)]) ); - }; - class GVAR(isNotSurrendering) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isSurrender', false)]) ); - }; class GVAR(isNotSwimming) { condition = QUOTE( !underwater ACE_player ); }; From 122a38a6aae70cdd5b978c028a5ca6486965b9a4 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 5 Feb 2015 16:39:45 -0600 Subject: [PATCH 08/16] More Refactoring --- addons/captives/CfgVehicles.hpp | 14 +++++----- addons/captives/XEH_postInitClient.sqf | 7 ++--- addons/captives/XEH_preInit.sqf | 12 ++++---- addons/captives/config.cpp | 6 ++-- ...eCaptive.sqf => fnc_canApplyHandcuffs.sqf} | 6 ++-- .../functions/fnc_canEscortCaptive.sqf | 2 +- .../captives/functions/fnc_canFriskPerson.sqf | 2 +- .../captives/functions/fnc_canLoadCaptive.sqf | 2 +- ...Captive.sqf => fnc_canRemoveHandcuffs.sqf} | 6 ++-- .../functions/fnc_canStopEscorting.sqf | 2 +- .../functions/fnc_canUnloadCaptive.sqf | 2 +- ...keCaptive.sqf => fnc_doApplyHandcuffs.sqf} | 6 ++-- .../functions/fnc_doEscortCaptive.sqf | 2 +- .../captives/functions/fnc_doLoadCaptive.sqf | 8 ++++-- ...eCaptive.sqf => fnc_doRemoveHandcuffs.sqf} | 2 +- .../functions/fnc_doUnloadCaptive.sqf | 2 +- .../captives/functions/fnc_handleGetOut.sqf | 7 ++--- .../captives/functions/fnc_handleKilled.sqf | 4 +-- .../functions/fnc_handlePlayerChanged.sqf | 2 +- .../functions/fnc_handleUnitInitPost.sqf | 10 +++---- .../captives/functions/fnc_handleWokeUp.sqf | 2 +- ...c_setCaptive.sqf => fnc_setHandcuffed.sqf} | 28 +++++++++++-------- addons/captives/functions/fnc_surrender.sqf | 4 +-- 23 files changed, 71 insertions(+), 67 deletions(-) rename addons/captives/functions/{fnc_canTakeCaptive.sqf => fnc_canApplyHandcuffs.sqf} (62%) rename addons/captives/functions/{fnc_canReleaseCaptive.sqf => fnc_canRemoveHandcuffs.sqf} (62%) rename addons/captives/functions/{fnc_doTakeCaptive.sqf => fnc_doApplyHandcuffs.sqf} (58%) rename addons/captives/functions/{fnc_doReleaseCaptive.sqf => fnc_doRemoveHandcuffs.sqf} (76%) rename addons/captives/functions/{fnc_setCaptive.sqf => fnc_setHandcuffed.sqf} (60%) diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 059b07cfb8..b4a120bc22 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -2,21 +2,21 @@ class CfgVehicles { class Man; class CAManBase: Man { class ACE_Actions { - class ACE_SetCaptive { + class ACE_ApplyHandcuffs { displayName = "$STR_ACE_Captives_SetCaptive"; distance = 4; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canTakeCaptive)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(doTakeCaptive)); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); hotkey = "C"; }; - class ACE_ReleaseCaptive { + class ACE_RemoveHandcuffs { displayName = "$STR_ACE_Captives_ReleaseCaptive"; distance = 4; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canReleaseCaptive)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(doReleaseCaptive)); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.4; @@ -27,7 +27,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive)); - statement = QUOTE([ARR_2(_target, true)] call FUNC(doEscortCaptive)); + statement = QUOTE([ARR_3(_target, _target, true)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); diff --git a/addons/captives/XEH_postInitClient.sqf b/addons/captives/XEH_postInitClient.sqf index ccec1d39d2..b55c9eb10c 100644 --- a/addons/captives/XEH_postInitClient.sqf +++ b/addons/captives/XEH_postInitClient.sqf @@ -1,12 +1,9 @@ #include "script_component.hpp" -[missionNamespace, "playerChanged", {_this call ACE_Captives_fnc_handlePlayerChanged}] call ACE_Core_fnc_addCustomEventhandler; - - - +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); ["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); ["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); -["SetCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); //TODO: Medical Integration Events??? diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index b3de41ae69..e894cd1c31 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -1,19 +1,19 @@ #include "script_component.hpp" ADDON = false; - + +PREP(canApplyHandcuffs); PREP(canEscortCaptive); PREP(canFriskPerson); PREP(canLoadCaptive); -PREP(canReleaseCaptive); +PREP(canRemoveHandcuffs); PREP(canStopEscorting); -PREP(canTakeCaptive); PREP(canUnloadCaptive); +PREP(doApplyHandcuffs); PREP(doEscortCaptive); PREP(doFriskPerson); PREP(doLoadCaptive); -PREP(doReleaseCaptive); -PREP(doTakeCaptive); +PREP(doRemoveHandcuffs); PREP(doUnloadCaptive); PREP(handleGetIn); PREP(handleGetOut); @@ -22,7 +22,7 @@ PREP(handleKnockedOut); PREP(handlePlayerChanged); PREP(handleUnitInitPost); PREP(handleWokeUp); -PREP(setCaptive); +PREP(setHandcuffed); PREP(surrender); PREP(vehicleCaptiveMoveIn); PREP(vehicleCaptiveMoveOut); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index d7cb36371d..bceeda3b2b 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -17,15 +17,13 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" -#define GVARFIX(var1) getVariable [ARR_2(QUOTE(GVAR(var1)), false)] - class ACE_canInteractConditions { class GVAR(isNotEscorting) { condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false))); }; - class GVAR(isNotCaptive) { - condition = QUOTE(!(GETVAR(player,QGVAR(isCaptive),false))); + class GVAR(isNotHandcuffed) { + condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false))); }; class GVAR(isNotSurrendering) { condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false))); diff --git a/addons/captives/functions/fnc_canTakeCaptive.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf similarity index 62% rename from addons/captives/functions/fnc_canTakeCaptive.sqf rename to addons/captives/functions/fnc_canApplyHandcuffs.sqf index f67f6110bf..8a3d143e96 100644 --- a/addons/captives/functions/fnc_canTakeCaptive.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -1,6 +1,6 @@ /* * Author: PabstMirror - * Checks the conditions for being able to take a unit captive + * Checks the conditions for being able to apply handcuffs * * Arguments: * 0: caller (player) @@ -18,6 +18,8 @@ PARAMS_2(_unit,_target); +//Player has cableTie, target is alive and not already handcuffed + ("ACE_CableTie" in (items _unit)) && {alive _target} && -{!(_target getVariable [QGVAR(isCaptive), false])} +{!(_target getVariable [QGVAR(isHandcuffed), false])} diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index 40a3e0d560..9bcb1d258a 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -18,7 +18,7 @@ PARAMS_2(_unit,_target); -(_target getVariable [QGVAR(isCaptive), false]) && +(_target getVariable [QGVAR(isHandcuffed), false]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable [QGVAR(ACE_isUnconscious), false])} diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf index 6ee44b2af5..9bbf5389c3 100644 --- a/addons/captives/functions/fnc_canFriskPerson.sqf +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -18,6 +18,6 @@ PARAMS_2(_unit,_target); -_target getVariable [QGVAR(isCaptive), false] +_target getVariable [QGVAR(isHandcuffed), false] || {_target getVariable ["ACE_isSearchable", false]} || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index a05765b195..3b1521e2be 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -23,7 +23,7 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); + _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); _target = _objects select 0; }; diff --git a/addons/captives/functions/fnc_canReleaseCaptive.sqf b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf similarity index 62% rename from addons/captives/functions/fnc_canReleaseCaptive.sqf rename to addons/captives/functions/fnc_canRemoveHandcuffs.sqf index 50b4c55310..f36488fbf1 100644 --- a/addons/captives/functions/fnc_canReleaseCaptive.sqf +++ b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf @@ -1,6 +1,6 @@ /* * Author: PabstMirror - * Checks the conditions for being able to release a captive + * Checks the conditions for being able to remove handcuffs * * Arguments: * 0: caller (player) @@ -18,6 +18,6 @@ PARAMS_2(_unit,_target); -//Unit is captive and not being escorted -_target getVariable [QGVAR(isCaptive), false] && +//Unit is handcuffed and not currently being escorted +_target getVariable [QGVAR(isHandcuffed), false] && {isNull (attachedTo _target)} diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf index 4f30e7a82a..66cf12c9fc 100644 --- a/addons/captives/functions/fnc_canStopEscorting.sqf +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -33,7 +33,7 @@ if (isNull _target) exitWith { _isAttached = _target in (attachedObjects _unit); -if (_isAttached && (!(_target getVariable [QGVAR(isCaptive), false]))) exitWith { +if (_isAttached && (!(_target getVariable [QGVAR(isHandcuffed), false]))) exitWith { ERROR("Attached But Not Captive"); false }; diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf index 1aef4602e1..3e014d72c7 100644 --- a/addons/captives/functions/fnc_canUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -23,6 +23,6 @@ PARAMS_2(_unit,_vehicle); _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. -_cargo = [_cargo, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); +_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); count _cargo > 0 diff --git a/addons/captives/functions/fnc_doTakeCaptive.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf similarity index 58% rename from addons/captives/functions/fnc_doTakeCaptive.sqf rename to addons/captives/functions/fnc_doApplyHandcuffs.sqf index 8deb712d09..9ae82916f7 100644 --- a/addons/captives/functions/fnc_doTakeCaptive.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -1,6 +1,6 @@ /* * Author: PabstMirror - * Checks the conditions for being able to take a unit captive + * Checks the conditions for being able to apply handcuffs * * Arguments: * 0: caller (player) @@ -18,5 +18,5 @@ PARAMS_2(_unit,_target); -_unit removeItem 'ACE_CableTie'; -["SetCaptive", [_target], [_target, true]] call EFUNC(common,targetEvent); +_unit removeItem "ACE_CableTie"; +["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index 05dc912205..d782bd8c62 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -19,7 +19,7 @@ PARAMS_3(_unit,_target,_state); -if !("ACE_Handcuffed" in ([_target] call ACE_Core_fnc_getCaptivityStatus)) exitWith { +if !("ACE_Handcuffed" in ([_target] call EFUNC(common,getCaptivityStatus))) exitWith { [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); }; diff --git a/addons/captives/functions/fnc_doLoadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf index 1ef650b4ee..92d1adecf8 100644 --- a/addons/captives/functions/fnc_doLoadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -21,14 +21,16 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); - _target = _objects select 0; + _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); + if ((count _objects) > 0) then {_target = _objects select 0;}; }; +if (isNull _target) exitWith {}; if (isNull _vehicle) then { _objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; - _vehicle = _objects select 0; + if ((count _objects) > 0) then {_vehicle = _objects select 0;}; }; +if (isNull _vehicle) exitWith {}; if ((!isNil "_target") && {!isNil "_vehicle"}) then { _unit setVariable [QGVAR(isEscorting), false, true]; diff --git a/addons/captives/functions/fnc_doReleaseCaptive.sqf b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf similarity index 76% rename from addons/captives/functions/fnc_doReleaseCaptive.sqf rename to addons/captives/functions/fnc_doRemoveHandcuffs.sqf index a807959565..01ca4ef436 100644 --- a/addons/captives/functions/fnc_doReleaseCaptive.sqf +++ b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf @@ -18,4 +18,4 @@ PARAMS_2(_unit,_target); -["SetCaptive", [_target], [_target, false]] call EFUNC(common,targetEvent); +["SetHandcuffed", [_target], [_target, false]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doUnloadCaptive.sqf b/addons/captives/functions/fnc_doUnloadCaptive.sqf index 1a6b6a2d0c..b4814fc564 100644 --- a/addons/captives/functions/fnc_doUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_doUnloadCaptive.sqf @@ -22,7 +22,7 @@ private ["_cargo", "_target"]; _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. -_cargo = [_cargo, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); +_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); if ((count _cargo) > 0) then { _target = _cargo select 0; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index 84c856ed39..00368532e7 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -19,12 +19,11 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if ((local _unit)&&(_unit getVariable [QGVAR(isCaptive), false])) then { - +if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { private ["_cargoIndex"]; - + _cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; - + //If captive was not "unloaded", then move them back into the vehicle. if (_cargoIndex != -1) exitWith { _unit moveInCargo [_vehicle, _cargoIndex]; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf index 6e41fa801a..5ac2935a2e 100644 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -17,8 +17,8 @@ PARAMS_1(_oldUnit); -if (_oldUnit getVariable [QGVAR(isCaptive), false]) then { - _oldUnit setVariable [QGVAR(isCaptive), false, true]; +if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then { + _oldUnit setVariable [QGVAR(isHandcuffed), false, true]; }; if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index d7efa70a5f..c3e148d6c4 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -18,7 +18,7 @@ PARAMS_2(_unit,_oldUnit); -if (_unit getVariable [QGVAR(isCaptive), false]) then { +if (_unit getVariable [QGVAR(isHandcuffed), false]) then { showHUD false; } else { showHUD true; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index a0e76c0a10..4450378129 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -17,13 +17,13 @@ PARAMS_1(_unit); -// prevent players from throwing grenades -[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isCaptive), false]}, {}] call EFUNC(common,addActionEventhandler); +// prevent players from throwing grenades (added to all units) +[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isHandcuffed), false]}, {}] call EFUNC(common,addActionEventhandler); if (local _unit) then { // reset status on mission start - if (_unit getVariable [QGVAR(isCaptive), false]) then { - _unit setVariable [QGVAR(isCaptive), false]; - [_unit, true] call FUNC(setCaptive); + if (_unit getVariable [QGVAR(isHandcuffed), false]) then { + _unit setVariable [QGVAR(isHandcuffed), false]; + [_unit, true] call FUNC(setHandcuffed); }; }; diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf index 2973aa7f83..af59b5c56e 100644 --- a/addons/captives/functions/fnc_handleWokeUp.sqf +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -17,7 +17,7 @@ PARAMS_1(_unit); -if (_unit getVariable [QGVAR(isCaptive), false] && {vehicle _unit == _unit}) then { +if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { [_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_setCaptive.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf similarity index 60% rename from addons/captives/functions/fnc_setCaptive.sqf rename to addons/captives/functions/fnc_setHandcuffed.sqf index eca34b3bac..94967dfb20 100644 --- a/addons/captives/functions/fnc_setCaptive.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -1,6 +1,6 @@ /* * Author: Nic547, commy2 - * Makes a civilian unable to move. + * Handcuffs a unit * * Arguments: * 0: Unit @@ -18,18 +18,26 @@ PARAMS_2(_unit,_state); -if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; +systemChat format ["set %1", _this]; + +if (!local _unit) exitWith { + ERROR("setHandcuffed unit not local"); +}; + +systemChat format ["set %1 %2 ", _state, (_unit getVariable [QGVAR(isHandcuffed), false])]; + +if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) exitWith { + ERROR("new state equals current"); +}; if (_state) then { - if (_unit getVariable [QGVAR(isCaptive), false]) exitWith {}; - - _unit setVariable [QGVAR(isCaptive), true, true]; + _unit setVariable [QGVAR(isHandcuffed), true, true]; // fix anim on mission start (should work on dedicated servers) _unit spawn { - [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; + [_this, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); - if (_this getVariable [QGVAR(isCaptive), false] && {vehicle _this == _this}) then { + if (_this getVariable [QGVAR(isHandcuffed), false] && {vehicle _this == _this}) then { [_this] call EFUNC(common,fixLoweredRifleAnimation); [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); }; @@ -41,10 +49,8 @@ if (_state) then { showHUD false; }; } else { - if !(_unit getVariable [QGVAR(isCaptive), false]) exitWith {}; - - _unit setVariable [QGVAR(isCaptive), false, true]; - [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; + _unit setVariable [QGVAR(isHandcuffed), false, true]; + [_unit, "ACE_Handcuffed", false] call EFUNC(common,setCaptivityStatus); if (vehicle _unit == _unit) then { [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 3d3b65ec49..69098c19a1 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -24,7 +24,7 @@ if (_state) then { if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {}; _unit setVariable [QGVAR(isSurrender), true, true]; - [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; + [_unit, "ACE_Surrendered", true] call EFUNC(common,setCaptivityStatus); _unit spawn { // fix for lowered rifle animation glitch @@ -49,7 +49,7 @@ if (_state) then { _this playMoveNow "unconscious"; }; - [_this, "ACE_Surrendered", false] call ACE_Core_fnc_setCaptivityStatus; + [_this, "ACE_Surrendered", false] call EFUNC(common,setCaptivityStatus); if (isPlayer _this) then {showHUD true}; }; From 82a8fc8ca315d21fee1ccf53a204ee093e976bc5 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 5 Feb 2015 23:11:28 -0600 Subject: [PATCH 09/16] exceptions --- addons/captives/CfgVehicles.hpp | 17 ++++--- .../functions/fnc_canEscortCaptive.sqf | 2 + .../functions/fnc_canStopEscorting.sqf | 2 +- .../functions/fnc_doEscortCaptive.sqf | 49 +++++++++---------- .../captives/functions/fnc_setHandcuffed.sqf | 5 +- addons/interaction/XEH_clientInit.sqf | 8 +-- 6 files changed, 41 insertions(+), 42 deletions(-) diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index b4a120bc22..8bd97b0b58 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -7,6 +7,7 @@ class CfgVehicles { distance = 4; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); + exceptions[] = {}; showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); @@ -17,7 +18,7 @@ class CfgVehicles { distance = 4; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + exceptions[] = {}; showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); @@ -27,8 +28,8 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive)); - statement = QUOTE([ARR_3(_target, _target, true)] call FUNC(doEscortCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + statement = QUOTE([ARR_3(_player, _target, true)] call FUNC(doEscortCaptive)); + exceptions[] = {}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.3; @@ -39,7 +40,7 @@ class CfgVehicles { distance = 4; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting)); statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + exceptions[] = {QGVAR(isNotEscorting)}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.3; @@ -50,7 +51,7 @@ class CfgVehicles { distance = 4; condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(loadCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + exceptions[] = {QGVAR(isNotEscorting)}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.2; @@ -73,7 +74,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_StopEscorting"; condition = QUOTE([ARR_2(_player, objNull)] call FUNC(canStopEscorting)); statement = QUOTE([ARR_3(_player,objNull, false)] call FUNC(doEscortCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + exceptions[] = {QGVAR(isNotEscorting)}; showDisabled = 0; priority = 2.3; hotkey = "C"; @@ -82,7 +83,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_LoadCaptive"; condition = "[_player, objNull, objNull] call ACE_Captives_fnc_canLoadCaptiveIntoVehicle"; statement = "[_player, objNull, objNull] call ACE_Captives_fnc_loadCaptiveIntoVehicle"; - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + exceptions[] = {QGVAR(isNotEscorting)}; showDisabled = 0; priority = 2.2; hotkey = "K"; @@ -97,7 +98,7 @@ class CfgVehicles { distance = 4; \ condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(loadCaptive)); \ - exceptions[] = {"ACE_Interaction_isNotEscorting"}; \ + exceptions[] = {QGVAR(isNotEscorting)}; \ showDisabled = 0; \ priority = 1.2; \ hotkey = "L"; \ diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index 9bcb1d258a..2d2fd5abe4 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -18,6 +18,8 @@ PARAMS_2(_unit,_target); +//Alive, handcuffed, not being escored, and not unconsious + (_target getVariable [QGVAR(isHandcuffed), false]) && {isNull (attachedTo _target)} && {alive _target} && diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf index 66cf12c9fc..bb48244a25 100644 --- a/addons/captives/functions/fnc_canStopEscorting.sqf +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -23,7 +23,7 @@ private ["_isAttached"]; if (isNull _target) then { - _target = _unit getVariable ["ACE_escortedUnit", objNull]; + _target = _unit getVariable [QGVAR(escortedUnit), objNull]; }; if (isNull _target) exitWith { diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index d782bd8c62..72a0cd0c6c 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -19,38 +19,37 @@ PARAMS_3(_unit,_target,_state); -if !("ACE_Handcuffed" in ([_target] call EFUNC(common,getCaptivityStatus))) exitWith { - [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); -}; - if (_state) then { - if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {}; + if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {}; - [_unit, _target] call EFUNC(common,claim); - _unit setVariable [QGVAR(isEscorting), true, true]; + [_unit, _target] call EFUNC(common,claim); + _unit setVariable [QGVAR(isEscorting), true, true]; - _target attachTo [_unit, [0, 1, 0]]; + _target attachTo [_unit, [0, 1, 0]]; - _unit setVariable ["ACE_escortedUnit", _target, true]; - _actionID = _unit addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], "[_unit getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (_unit getVariable ['ACE_escortedUnit', objNull])"]; + _unit setVariable [QGVAR(escortedUnit), _target, true]; - [_target, _actionID] spawn { - _target = _this select 0; - _actionID = _this select 1; + //Add Actionmenu to release captive + _actionID = _unit addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], + {[(_this select 0), ((_this select 0) getVariable [QGVAR(escortedUnit), objNull]), false] call FUNC(doEscortCaptive);}, + nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))]; - while {_unit getVariable [QGVAR(isEscorting), false]} do { - sleep 0.2; + [_unit, _target, _actionID] spawn { + PARAMS_3(_unit,_target,_actionID); - if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { - _unit setVariable [QGVAR(isEscorting), false, true]; - }; + while {_unit getVariable [QGVAR(isEscorting), false]} do { + sleep 0.2; + + if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { + _unit setVariable [QGVAR(isEscorting), false, true]; + }; + }; + [objNull, _target] call EFUNC(common,claim); + + detach _target; + _unit removeAction _actionID; }; - [objNull, _target] call EFUNC(common,claim); - - detach _target; - _unit removeAction _actionID; - }; } else { - _unit setVariable [QGVAR(isEscorting), false, true]; - _unit setVariable ["ACE_escortedUnit", objNull, true]; + _unit setVariable [QGVAR(isEscorting), false, true]; + _unit setVariable [QGVAR(escortedUnit), objNull, true]; }; diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 94967dfb20..c28a26909f 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -18,14 +18,11 @@ PARAMS_2(_unit,_state); -systemChat format ["set %1", _this]; if (!local _unit) exitWith { ERROR("setHandcuffed unit not local"); }; -systemChat format ["set %1 %2 ", _state, (_unit getVariable [QGVAR(isHandcuffed), false])]; - if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) exitWith { ERROR("new state equals current"); }; @@ -50,7 +47,7 @@ if (_state) then { }; } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; - [_unit, "ACE_Handcuffed", false] call EFUNC(common,setCaptivityStatus); + [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); if (vehicle _unit == _unit) then { [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; diff --git a/addons/interaction/XEH_clientInit.sqf b/addons/interaction/XEH_clientInit.sqf index bcc3f47def..71be601ac7 100644 --- a/addons/interaction/XEH_clientInit.sqf +++ b/addons/interaction/XEH_clientInit.sqf @@ -20,7 +20,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenu", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(isNull (findDisplay 1713999)) exitWith {false}; @@ -38,7 +38,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenu", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; @@ -56,7 +56,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenuSelf", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(isNull (findDisplay 1713999)) exitWith {false}; @@ -74,7 +74,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenuSelf", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; From 7a3029b9fdbdc5ac21cf546ccac5ea0130f9b17f Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 6 Feb 2015 03:38:27 -0600 Subject: [PATCH 10/16] replace spawns --- addons/captives/CfgEventHandlers.hpp | 2 +- addons/captives/CfgVehicles.hpp | 8 ++-- addons/captives/XEH_postInit.sqf | 32 +++++++++++++ addons/captives/XEH_postInitClient.sqf | 16 ------- .../functions/fnc_canApplyHandcuffs.sqf | 4 +- .../functions/fnc_canEscortCaptive.sqf | 6 +-- .../captives/functions/fnc_canLoadCaptive.sqf | 15 ++++--- .../functions/fnc_canRemoveHandcuffs.sqf | 2 +- .../functions/fnc_doApplyHandcuffs.sqf | 2 +- .../functions/fnc_doEscortCaptive.sqf | 22 +++++---- .../captives/functions/fnc_handleGetOut.sqf | 6 +-- .../captives/functions/fnc_handleKilled.sqf | 4 +- .../functions/fnc_handlePlayerChanged.sqf | 8 ++-- .../functions/fnc_handleUnitInitPost.sqf | 30 ++++++------- .../captives/functions/fnc_setHandcuffed.sqf | 23 +++++----- addons/captives/functions/fnc_surrender.sqf | 45 ++++++++----------- .../functions/fnc_vehicleCaptiveMoveIn.sqf | 2 +- .../functions/fnc_vehicleCaptiveMoveOut.sqf | 2 +- 18 files changed, 123 insertions(+), 106 deletions(-) create mode 100644 addons/captives/XEH_postInit.sqf delete mode 100644 addons/captives/XEH_postInitClient.sqf diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index 07dbe45fb7..722750f915 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -6,7 +6,7 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient)); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 8bd97b0b58..65d574fab0 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -50,7 +50,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_LoadCaptive"; distance = 4; condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); - statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(loadCaptive)); + statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(doLoadCaptive)); exceptions[] = {QGVAR(isNotEscorting)}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); @@ -61,7 +61,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_FriskPerson"; distance = 2; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(openFriskMenu)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doFriskPerson)); showDisabled = 0; //icon = ""; //@todo priority = 3; @@ -97,7 +97,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_LoadCaptive"; \ distance = 4; \ condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ - statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(loadCaptive)); \ + statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(doLoadCaptive)); \ exceptions[] = {QGVAR(isNotEscorting)}; \ showDisabled = 0; \ priority = 1.2; \ @@ -107,7 +107,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_UnloadCaptive"; \ distance = 4; \ condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ - statement = QUOTE([ARR_2(_player, _target)] call FUNC(unloadCaptive)); \ + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \ showDisabled = 0; \ priority = 1.2; \ hotkey = "C"; \ diff --git a/addons/captives/XEH_postInit.sqf b/addons/captives/XEH_postInit.sqf new file mode 100644 index 0000000000..9d1a242d4d --- /dev/null +++ b/addons/captives/XEH_postInit.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" + +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); +["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); + +//Handles when someone starts escorting and then disconnects, leaving the captive attached +//This is normaly handled by the PFEH in doEscortCaptive, but that won't be running if they DC +if (isServer) then { + addMissionEventHandler ["HandleDisconnect", { + PARAMS_1(_disconnectedPlayer); + _escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull]; + if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then { + detach _escortedUnit; + systemChat "debug: DC detach"; + }; + if (_disconnectedPlayer getVariable [QGVAR(isEscorting), false]) then { + _disconnectedPlayer setVariable [QGVAR(isEscorting), false, true]; + }; + }]; +}; + +//TODO: Medical Integration Events??? + +// [_unit, "knockedOut", { +// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; +// }] call ACE_Core_fnc_addCustomEventhandler; + +// [_unit, "wokeUp", { +// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; +// }] call ACE_Core_fnc_addCustomEventhandler; diff --git a/addons/captives/XEH_postInitClient.sqf b/addons/captives/XEH_postInitClient.sqf deleted file mode 100644 index b55c9eb10c..0000000000 --- a/addons/captives/XEH_postInitClient.sqf +++ /dev/null @@ -1,16 +0,0 @@ -#include "script_component.hpp" - -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); -["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); -["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); - -//TODO: Medical Integration Events??? - -// [_unit, "knockedOut", { - // if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; -// }] call ACE_Core_fnc_addCustomEventhandler; - -// [_unit, "wokeUp", { - // if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; -// }] call ACE_Core_fnc_addCustomEventhandler; diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf index 8a3d143e96..8f503d8fd0 100644 --- a/addons/captives/functions/fnc_canApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -20,6 +20,6 @@ PARAMS_2(_unit,_target); //Player has cableTie, target is alive and not already handcuffed -("ACE_CableTie" in (items _unit)) && -{alive _target} && +("ACE_CableTie" in (items _unit)) && +{alive _target} && {!(_target getVariable [QGVAR(isHandcuffed), false])} diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index 2d2fd5abe4..3d026e3d54 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -20,7 +20,7 @@ PARAMS_2(_unit,_target); //Alive, handcuffed, not being escored, and not unconsious -(_target getVariable [QGVAR(isHandcuffed), false]) && -{isNull (attachedTo _target)} && -{alive _target} && +(_target getVariable [QGVAR(isHandcuffed), false]) && +{isNull (attachedTo _target)} && +{alive _target} && {!(_target getVariable [QGVAR(ACE_isUnconscious), false])} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index 3b1521e2be..902ec36331 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -4,8 +4,8 @@ * * Arguments: * 0: Unit that wants to load a captive - * 1: A captive. ObjNull for the first escorted captive - * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle + * 1: A captive. ObjNull for the first escorted captive (may be null) + * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (may be null) * * Return Value: * The return value @@ -24,15 +24,16 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); - _target = _objects select 0; + if ((count _objects) > 0) then {_target = _objects select 0;}; }; if (isNull _vehicle) then { _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10]; - _vehicle = _objects select 0; + if ((count _objects) > 0) then {_vehicle = _objects select 0;}; }; -_unit getVariable [QGVAR(isEscorting), false] -&& {!isNil "_target"} -&& {!isNil "_vehicle"} +(!isNull _target) +&& {!isNull _vehicle} +&& {_unit getVariable [QGVAR(isEscorting), false]} +&& {_target getVariable [QGVAR(isHandcuffed), false]} && {_vehicle emptyPositions "cargo" > 0} diff --git a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf index f36488fbf1..d36042b0ab 100644 --- a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf +++ b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf @@ -19,5 +19,5 @@ PARAMS_2(_unit,_target); //Unit is handcuffed and not currently being escorted -_target getVariable [QGVAR(isHandcuffed), false] && +_target getVariable [QGVAR(isHandcuffed), false] && {isNull (attachedTo _target)} diff --git a/addons/captives/functions/fnc_doApplyHandcuffs.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf index 9ae82916f7..6c44df3dc5 100644 --- a/addons/captives/functions/fnc_doApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -18,5 +18,5 @@ PARAMS_2(_unit,_target); -_unit removeItem "ACE_CableTie"; +_unit removeItem "ACE_CableTie"; ["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index 72a0cd0c6c..fbbcd09947 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -34,21 +34,25 @@ if (_state) then { {[(_this select 0), ((_this select 0) getVariable [QGVAR(escortedUnit), objNull]), false] call FUNC(doEscortCaptive);}, nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))]; - [_unit, _target, _actionID] spawn { - PARAMS_3(_unit,_target,_actionID); - - while {_unit getVariable [QGVAR(isEscorting), false]} do { - sleep 0.2; - + private "_escortFnc"; + _escortFnc = { + EXPLODE_3_PVT((_this select 0),_unit,_target,_actionID); + if (_unit getVariable [QGVAR(isEscorting), false]) then { if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { _unit setVariable [QGVAR(isEscorting), false, true]; }; }; - [objNull, _target] call EFUNC(common,claim); - detach _target; - _unit removeAction _actionID; + if (!(_unit getVariable [QGVAR(isEscorting), false])) then { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + [objNull, _target] call EFUNC(common,claim); + detach _target; + _unit removeAction _actionID; + _unit setVariable [QGVAR(escortedUnit), objNull, true]; + }; }; + [_escortFnc, 0.2, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler; + } else { _unit setVariable [QGVAR(isEscorting), false, true]; _unit setVariable [QGVAR(escortedUnit), objNull, true]; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index 00368532e7..b212377dd2 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -21,9 +21,9 @@ PARAMS_3(_vehicle,_dontcare,_unit); if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { private ["_cargoIndex"]; - - _cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; - + + _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1]; + //If captive was not "unloaded", then move them back into the vehicle. if (_cargoIndex != -1) exitWith { _unit moveInCargo [_vehicle, _cargoIndex]; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf index 5ac2935a2e..219bd2eb60 100644 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -1,6 +1,6 @@ /* * Author: PabstMirror - * Handles when a unit is kill. Reset captivity and escorting status when getting killed + * Handles when a unit is kill. Reset captivity and escorting status * * Arguments: * 0: _oldUnit @@ -22,5 +22,5 @@ if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then { }; if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { - _oldUnit setVariable [QGVAR(isEscorting), false, true] + _oldUnit setVariable [QGVAR(isEscorting), false, true]; }; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index c3e148d6c4..af6472c211 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -1,9 +1,9 @@ /* * Author: commy2 - * TODO + * Handles playerChanged. Resets "showHUD" based on handcuff status * * Arguments: - * 0: _unit + * 0: _newUnit * 1: _oldUnit * * Return Value: @@ -16,9 +16,9 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_oldUnit); +PARAMS_2(_newUnit,_oldUnit); -if (_unit getVariable [QGVAR(isHandcuffed), false]) then { +if (_newUnit getVariable [QGVAR(isHandcuffed), false]) then { showHUD false; } else { showHUD true; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index 4450378129..d34eebeb4a 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -1,24 +1,24 @@ /* -* Author: commy2 -* handle captive and unconsciousness state and prevent grenades -* -* Arguments: -* 0: _unit -* -* Return Value: -* The return value -* -* Example: -* TODO -* -* Public: No -*/ + * Author: commy2 + * handle captive and unconsciousness state and prevent grenades + * + * Arguments: + * 0: _unit + * + * Return Value: + * The return value + * + * Example: + * TODO + * + * Public: No + */ #include "script_component.hpp" PARAMS_1(_unit); // prevent players from throwing grenades (added to all units) -[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isHandcuffed), false]}, {}] call EFUNC(common,addActionEventhandler); +[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isHandcuffed), false]}, {hint format ["%1 - debug throw prevented",time];}] call EFUNC(common,addActionEventhandler); if (local _unit) then { // reset status on mission start diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index c28a26909f..98a12168d3 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -29,31 +29,34 @@ if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) exitWith if (_state) then { _unit setVariable [QGVAR(isHandcuffed), true, true]; + [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); // fix anim on mission start (should work on dedicated servers) - _unit spawn { - [_this, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); - if (_this getVariable [QGVAR(isHandcuffed), false] && {vehicle _this == _this}) then { - [_this] call EFUNC(common,fixLoweredRifleAnimation); - [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); + _fixAnimationFnc = { + PARAMS_1(_unit); + if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); }; }; - _unit setVariable ["ACE_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; + [_fixAnimationFnc, [_unit], 0.05, 0] call EFUNC(common,waitAndExecute); + + _unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true]; if (_unit == ACE_player) then { showHUD false; }; } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; - [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); - if (vehicle _unit == _unit) then { + [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); + if ((vehicle _unit) == _unit) then { [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; - if (_unit getVariable ["ACE_Captives_CargoIndex", -1] != -1) then { - _unit setVariable ["ACE_Captives_CargoIndex", -1, true]; + if (_unit getVariable [QGVAR(CargoIndex), -1] != -1) then { + _unit setVariable [QGVAR(CargoIndex), -1, true]; }; if (_unit == ACE_player) then { diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 69098c19a1..7c5adc08de 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -26,38 +26,31 @@ if (_state) then { _unit setVariable [QGVAR(isSurrender), true, true]; [_unit, "ACE_Surrendered", true] call EFUNC(common,setCaptivityStatus); - _unit spawn { - // fix for lowered rifle animation glitch - if (currentWeapon _this != "" && {currentWeapon _this == primaryWeapon _this} && {weaponLowered _this} && {stance _this == "STAND"}) then { - _this playMove "amovpercmstpsraswrfldnon"; - }; - while {_this getVariable [QGVAR(isSurrender), false]} do { - sleep 0.001; //sleep in UI - - if (isPlayer _this) then {showHUD false}; - - if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { - _this setVariable [QGVAR(isSurrender), false, true]; + private "_surrenderFnc"; + _surrenderFnc = { + EXPLODE_1_PVT((_this select 0),_unit); + if (_unit getVariable [QGVAR(isSurrender), false]) then { + if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then { + _unit setVariable [QGVAR(isSurrender), false, true]; } else { - _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; + [_unit, "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon", 0] call EFUNC(common,doAnimation); }; }; - if !(_this getVariable ["ACE_isUnconscious", false]) then { - _this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; - } else { - _this playMoveNow "unconscious"; + + if (!(_unit getVariable [QGVAR(isSurrender), false])) then { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + + if !(_unit getVariable ["ACE_isUnconscious", false]) then { + [_unit, "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 1] call EFUNC(common,doAnimation); + } else { + [_unit, "unconscious", 1] call EFUNC(common,doAnimation); + }; + [_unit, "ACE_Surrendered", false] call EFUNC(common,setCaptivityStatus); + if (isPlayer _unit) then {showHUD true}; }; - - [_this, "ACE_Surrendered", false] call EFUNC(common,setCaptivityStatus); - - if (isPlayer _this) then {showHUD true}; }; + [_surrenderFnc, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; } else { _unit setVariable [QGVAR(isSurrender), false, true]; }; - -/* -player playMove "AmovPercMstpSsurWnonDnon" -player switchMove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon" - */ diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf index fe4d0528c6..dd3b6e6818 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -23,6 +23,6 @@ private ["_cargoIndex"]; _target moveInCargo _vehicle; _target assignAsCargo _vehicle; _cargoIndex = _vehicle getCargoIndex _target; -_target setVariable ["ACE_Captives_CargoIndex", _cargoIndex, true]; +_target setVariable [QGVAR(CargoIndex), _cargoIndex, true]; TRACE_3("moveinEH",_target,_vehicle,_cargoIndex); diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf index 0a10572909..4210e8da15 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf @@ -17,7 +17,7 @@ PARAMS_1(_unit); -_unit setVariable ["ACE_Captives_CargoIndex", -1, true]; +_unit setVariable [QGVAR(CargoIndex), -1, true]; moveOut _unit; [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); From 98564fae683a212798f3c29542972cbefa40d20e Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 6 Feb 2015 15:54:26 -0600 Subject: [PATCH 11/16] Surrendering --- addons/captives/CfgMoves.hpp | 79 ++++++++----------- addons/captives/CfgVehicles.hpp | 25 +++--- addons/captives/XEH_preInit.sqf | 1 + addons/captives/config.cpp | 2 +- .../captives/functions/fnc_canSurrender.sqf | 22 ++++++ .../functions/fnc_handleUnitInitPost.sqf | 7 +- .../captives/functions/fnc_setHandcuffed.sqf | 1 - addons/captives/functions/fnc_surrender.sqf | 51 ++++++------ addons/captives/stringtable.xml | 12 ++- addons/interaction/XEH_clientInit.sqf | 4 +- 10 files changed, 121 insertions(+), 83 deletions(-) create mode 100644 addons/captives/functions/fnc_canSurrender.sqf diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index ab379de6ae..bb6b8669e0 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -1,7 +1,7 @@ class CfgMovesBasic { class Actions { class CivilStandActions; - class ACE_CivilStandCaptiveActions: CivilStandActions { + class ACE_CivilStandHandcuffedActions: CivilStandActions { turnL = ""; turnR = ""; stop = "ACE_AmovPercMstpScapWnonDnon"; @@ -11,6 +11,11 @@ class CfgMovesBasic { throwPrepare = ""; throwGrenade[] = {"","Gesture"}; }; + class ACE_CivilStandSurrenderActions: ACE_CivilStandHandcuffedActions { + stop = "ACE_AmovPercMstpScapWnonDnon"; + StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; + default = "ACE_AmovPercMstpScapWnonDnon"; + }; }; }; @@ -18,12 +23,14 @@ class CfgMovesMaleSdr: CfgMovesBasic { class StandBase; class States { class AmovPercMstpSnonWnonDnon: StandBase { - ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; }; class CutSceneAnimationBase; + + //Handcuffed Anims: class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { - actions = "ACE_CivilStandCaptiveActions"; + actions = "ACE_CivilStandHandcuffedActions"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; speed = 1; looped = 0; @@ -31,7 +38,6 @@ class CfgMovesMaleSdr: CfgMovesBasic { ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; }; - class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; speed = 0; @@ -39,52 +45,37 @@ class CfgMovesMaleSdr: CfgMovesBasic { InterpolateTo[] = {"Unconscious",0.01}; looped = 1; }; - class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { actions = "CivilStandActions"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; }; + + //Surrender Anims: + class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { + actions = "ACE_CivilStandSurrenderActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"; + speed = 1; + looped = 0; + interpolationRestart = 2; + ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + }; + class ACE_AmovPercMstpSsurWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon"; + speed = 0; + looped = 1; + ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01}; + }; + class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { + speed = 0.4; //for gameplay reasons, slow this down + actions = "CivilStandActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; + ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; + }; }; }; -/* -player playMove "ACE_AmovPercMstpScapWnonDnon"; -player switchMove "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon"; - */ - -/*class CfgMovesBasic; -class CfgMovesMaleSdr: CfgMovesBasic { -class States { - class CutSceneAnimationBase; - class AmovPercMstpSnonWnonDnon_EaseIn: CutSceneAnimationBase { - head = "headDefault"; - static = 1; - disableWeapons = 0; - forceAim = 0; - InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseOut",0.02,"Unconscious",0.1}; - }; - class AmovPercMstpSnonWnonDnon_Ease: AmovPercMstpSnonWnonDnon_EaseIn { - looped = 1; - InterpolateTo[] = {"Unconscious",0.1}; - }; - class AmovPercMstpSnonWnonDnon_EaseOut: AmovPercMstpSnonWnonDnon_EaseIn { - InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseIn",0.02,"Unconscious",0.1}; - }; - - class AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { - InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - }; - - class AmovPercMstpSsurWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - looped = 1; - InterpolateTo[] = {"Unconscious",0.01}; - }; - - class AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; - }; -}; -};*/ - diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 65d574fab0..934e1215d2 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -78,16 +78,23 @@ class CfgVehicles { showDisabled = 0; priority = 2.3; hotkey = "C"; + }; + class ACE_StartSurrenderingSelf { + displayName = "$STR_ACE_Captives_StartSurrendering"; + condition = QUOTE([ARR_2(_player, true)] call FUNC(canSurrender)); + statement = QUOTE([ARR_2(_player, true)] call FUNC(surrender)); + exceptions[] = {}; + showDisabled = 0; + priority = 0; + }; + class ACE_StopSurrenderingSelf { + displayName = "$STR_ACE_Captives_StopSurrendering"; + condition = QUOTE([ARR_2(_player, false)] call FUNC(canSurrender)); + statement = QUOTE([ARR_2(_player, false)] call FUNC(surrender)); + exceptions[] = {QGVAR(isNotSurrendering)}; + showDisabled = 0; + priority = 0; }; - /*class ACE_LoadCaptiveSelf { - displayName = "$STR_ACE_Captives_LoadCaptive"; - condition = "[_player, objNull, objNull] call ACE_Captives_fnc_canLoadCaptiveIntoVehicle"; - statement = "[_player, objNull, objNull] call ACE_Captives_fnc_loadCaptiveIntoVehicle"; - exceptions[] = {QGVAR(isNotEscorting)}; - showDisabled = 0; - priority = 2.2; - hotkey = "K"; - };*/ }; }; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index e894cd1c31..a98bf73443 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -8,6 +8,7 @@ PREP(canFriskPerson); PREP(canLoadCaptive); PREP(canRemoveHandcuffs); PREP(canStopEscorting); +PREP(canSurrender); PREP(canUnloadCaptive); PREP(doApplyHandcuffs); PREP(doEscortCaptive); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index bceeda3b2b..c0a34e3222 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -26,6 +26,6 @@ class ACE_canInteractConditions { condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false))); }; class GVAR(isNotSurrendering) { - condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false))); + condition = QUOTE(!(GETVAR(player,QGVAR(isSurrendering),false))); }; }; diff --git a/addons/captives/functions/fnc_canSurrender.sqf b/addons/captives/functions/fnc_canSurrender.sqf new file mode 100644 index 0000000000..60dcd7c938 --- /dev/null +++ b/addons/captives/functions/fnc_canSurrender.sqf @@ -0,0 +1,22 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to surrender + * + * Arguments: + * 0: caller (player) + * 1: New Surrender State to test + * + * Return Value: + * The return value + * + * Example: + * [player, true] call ACE_captives_fnc_canSurrender; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_newSurrenderState); + +//TODO: any other conditions?? +(!((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _newSurrenderState)) diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index d34eebeb4a..635d7b0439 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -18,7 +18,7 @@ PARAMS_1(_unit); // prevent players from throwing grenades (added to all units) -[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isHandcuffed), false]}, {hint format ["%1 - debug throw prevented",time];}] call EFUNC(common,addActionEventhandler); +[_unit, "Throw", {((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}}, {}] call EFUNC(common,addActionEventhandler); if (local _unit) then { // reset status on mission start @@ -26,4 +26,9 @@ if (local _unit) then { _unit setVariable [QGVAR(isHandcuffed), false]; [_unit, true] call FUNC(setHandcuffed); }; + + if (_unit getVariable [QGVAR(isSurrendering), false]) then { + _unit setVariable [QGVAR(isSurrendering), false]; + [_unit, true] call FUNC(surrender); + }; }; diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 98a12168d3..1be72ca7c9 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -32,7 +32,6 @@ if (_state) then { [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); // fix anim on mission start (should work on dedicated servers) - _fixAnimationFnc = { PARAMS_1(_unit); if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 7c5adc08de..bb782d85da 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -1,6 +1,6 @@ /* - * Author: commy2 - * TODO + * Author: commy2 PabstMirror + * Lets a unit surrender * * Arguments: * 0: Unit @@ -18,39 +18,42 @@ PARAMS_2(_unit,_state); -if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; - if (_state) then { - if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {}; - - _unit setVariable [QGVAR(isSurrender), true, true]; - [_unit, "ACE_Surrendered", true] call EFUNC(common,setCaptivityStatus); + if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith {}; + _unit setVariable [QGVAR(isSurrendering), true, true]; + [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); + [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); private "_surrenderFnc"; _surrenderFnc = { EXPLODE_1_PVT((_this select 0),_unit); - if (_unit getVariable [QGVAR(isSurrender), false]) then { + + if (_unit getVariable [QGVAR(isSurrendering), false]) then { if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then { - _unit setVariable [QGVAR(isSurrender), false, true]; - } else { - [_unit, "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon", 0] call EFUNC(common,doAnimation); + [_unit, false] call FUNC(surrender); + [(_this select 1)] call cba_fnc_removePerFrameHandler; }; - }; - - if (!(_unit getVariable [QGVAR(isSurrender), false])) then { + } else { [(_this select 1)] call cba_fnc_removePerFrameHandler; - - if !(_unit getVariable ["ACE_isUnconscious", false]) then { - [_unit, "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 1] call EFUNC(common,doAnimation); - } else { - [_unit, "unconscious", 1] call EFUNC(common,doAnimation); - }; - [_unit, "ACE_Surrendered", false] call EFUNC(common,setCaptivityStatus); - if (isPlayer _unit) then {showHUD true}; }; }; [_surrenderFnc, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; } else { - _unit setVariable [QGVAR(isSurrender), false, true]; + _unit setVariable [QGVAR(isSurrendering), false, true]; + + if !(_unit getVariable ["ACE_isUnconscious", false]) then { + //Break out of hands up animation loop + //don't want to step on animations from medical (TODO: testing medical integration) + [_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); + }; + + [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); + + if (_unit == ACE_player) then { + //only enable if not handcuffed + if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { + showHUD true; + }; + }; }; diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index eaf63b2d41..7d8096b3e6 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -1,5 +1,5 @@  - + @@ -71,6 +71,7 @@ Naložit zajatce Fogoly berakása Загрузить пленного + Embarcar Prisioneiro Unload Captive @@ -81,6 +82,7 @@ Vyložit zajatce Fogoly kivevése Выгрузить пленного + Desembarcar Prisioneiro Cable Tie @@ -115,6 +117,7 @@ Inventář prohledávané osoby Ekwipunek rewidowanej osoby Инвентарь обысканных лиц + Inventário da pessoa revistada Frisk person @@ -125,6 +128,13 @@ Rewiduj osobę Motozás Обыскать человека + Revistar + + + Surrender + + + Stop Surrendering \ No newline at end of file diff --git a/addons/interaction/XEH_clientInit.sqf b/addons/interaction/XEH_clientInit.sqf index 71be601ac7..1c314078a4 100644 --- a/addons/interaction/XEH_clientInit.sqf +++ b/addons/interaction/XEH_clientInit.sqf @@ -56,7 +56,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenuSelf", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), QEGVAR(captives,isNotSurrendering), "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(isNull (findDisplay 1713999)) exitWith {false}; @@ -74,7 +74,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenuSelf", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), QEGVAR(captives,isNotSurrendering), "ACE_Interaction_isNotSwimming"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; From c117e9bf160e293239561946014e0b244928bcca Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 6 Feb 2015 17:03:56 -0600 Subject: [PATCH 12/16] Header Examples --- addons/captives/functions/fnc_canApplyHandcuffs.sqf | 2 +- addons/captives/functions/fnc_canEscortCaptive.sqf | 4 ++-- addons/captives/functions/fnc_canFriskPerson.sqf | 2 +- addons/captives/functions/fnc_canLoadCaptive.sqf | 2 +- addons/captives/functions/fnc_canRemoveHandcuffs.sqf | 2 +- addons/captives/functions/fnc_canStopEscorting.sqf | 3 +-- addons/captives/functions/fnc_canSurrender.sqf | 2 +- addons/captives/functions/fnc_canUnloadCaptive.sqf | 2 +- addons/captives/functions/fnc_doApplyHandcuffs.sqf | 2 +- addons/captives/functions/fnc_doEscortCaptive.sqf | 2 +- addons/captives/functions/fnc_doFriskPerson.sqf | 2 +- addons/captives/functions/fnc_doLoadCaptive.sqf | 2 +- addons/captives/functions/fnc_doRemoveHandcuffs.sqf | 7 +++---- addons/captives/functions/fnc_doUnloadCaptive.sqf | 2 +- addons/captives/functions/fnc_handleGetIn.sqf | 2 +- addons/captives/functions/fnc_handleGetOut.sqf | 4 ++-- addons/captives/functions/fnc_handleKilled.sqf | 6 +++++- .../captives/functions/fnc_handlePlayerChanged.sqf | 4 ++-- addons/captives/functions/fnc_handleUnitInitPost.sqf | 2 +- addons/captives/functions/fnc_handleWokeUp.sqf | 2 +- addons/captives/functions/fnc_setHandcuffed.sqf | 2 +- addons/captives/functions/fnc_surrender.sqf | 12 +++++++++--- .../captives/functions/fnc_vehicleCaptiveMoveIn.sqf | 4 +--- .../captives/functions/fnc_vehicleCaptiveMoveOut.sqf | 4 ++-- 24 files changed, 42 insertions(+), 36 deletions(-) diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf index 8f503d8fd0..f69bb2544d 100644 --- a/addons/captives/functions/fnc_canApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canApplyHandcuffs * * Public: No */ diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index 3d026e3d54..cbb098881f 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -4,13 +4,13 @@ * * Arguments: * 0: caller (player) - * 1: target + * 1: target * * Return Value: * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canEscortCaptive * * Public: No */ diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf index 9bbf5389c3..28a9ee0134 100644 --- a/addons/captives/functions/fnc_canFriskPerson.sqf +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canFriskPerson * * Public: No */ diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index 902ec36331..04b33ad42d 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -11,7 +11,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canLoadCaptive * * Public: No */ diff --git a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf index d36042b0ab..4642cd90fd 100644 --- a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf +++ b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canRemoveHandcuffs * * Public: No */ diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf index bb48244a25..e6a5a0e568 100644 --- a/addons/captives/functions/fnc_canStopEscorting.sqf +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canStopEscorting * * Public: No */ @@ -21,7 +21,6 @@ DEFAULT_PARAM(1,_target,objNull); private ["_isAttached"]; - if (isNull _target) then { _target = _unit getVariable [QGVAR(escortedUnit), objNull]; }; diff --git a/addons/captives/functions/fnc_canSurrender.sqf b/addons/captives/functions/fnc_canSurrender.sqf index 60dcd7c938..238087c62b 100644 --- a/addons/captives/functions/fnc_canSurrender.sqf +++ b/addons/captives/functions/fnc_canSurrender.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * [player, true] call ACE_captives_fnc_canSurrender; + * [Jean, true] call ACE_captives_fnc_canSurrender; * * Public: No */ diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf index 3e014d72c7..a86bdae588 100644 --- a/addons/captives/functions/fnc_canUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -11,7 +11,7 @@ * The return value * * Example: - * - + * [player, bob, car1] call ACE_captives_fnc_canUnloadCaptive; * * Public: No */ diff --git a/addons/captives/functions/fnc_doApplyHandcuffs.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf index 6c44df3dc5..8abf8c836c 100644 --- a/addons/captives/functions/fnc_doApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_doApplyHandcuffs; * * Public: No */ diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index fbbcd09947..299aa81631 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -11,7 +11,7 @@ * The return value * * Example: - * - + * [player, bob, true] call ACE_captives_fnc_doEscorteCaptive; * * Public: No */ diff --git a/addons/captives/functions/fnc_doFriskPerson.sqf b/addons/captives/functions/fnc_doFriskPerson.sqf index d69dbd045c..14b18ffd0e 100644 --- a/addons/captives/functions/fnc_doFriskPerson.sqf +++ b/addons/captives/functions/fnc_doFriskPerson.sqf @@ -10,7 +10,7 @@ * Nothing * * Example: - * TODO + * [player, bob] call ACE_captives_fnc_doFristPerson; * * Public: No */ diff --git a/addons/captives/functions/fnc_doLoadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf index 92d1adecf8..9fd65a130d 100644 --- a/addons/captives/functions/fnc_doLoadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -11,7 +11,7 @@ * Nothing * * Example: - * TODO + * [bob, tom, car] call ACE_captives_fnc_doLoadCaptive * * Public: No */ diff --git a/addons/captives/functions/fnc_doRemoveHandcuffs.sqf b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf index 01ca4ef436..a69decf620 100644 --- a/addons/captives/functions/fnc_doRemoveHandcuffs.sqf +++ b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf @@ -1,16 +1,15 @@ /* * Author: PabstMirror - * Release a captive + * Remove handcuffs from a target * * Arguments: - * 0: caller (player) - * 1: target + * 0: target * * Return Value: * The return value * * Example: - * - + * [bob, false] call ACE_captives_fnc_doRemoveHandcuffs * * Public: No */ diff --git a/addons/captives/functions/fnc_doUnloadCaptive.sqf b/addons/captives/functions/fnc_doUnloadCaptive.sqf index b4814fc564..b7fa57a7bb 100644 --- a/addons/captives/functions/fnc_doUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_doUnloadCaptive.sqf @@ -10,7 +10,7 @@ * Nothing * * Example: - * TODO + * [bob, car] call ACE_captives_fnc_doUnloadCaptive * * Public: No */ diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf index eb3a9ad8b1..54133e2362 100644 --- a/addons/captives/functions/fnc_handleGetIn.sqf +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -11,7 +11,7 @@ * The return value * * Example: - * - + * [car2, x, player] call ACE_captives_fnc_handleGetIn * * Public: No */ diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index b212377dd2..4bf9a1fa19 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -11,7 +11,7 @@ * The return value * * Example: - * - + * [car2, x, player] call ACE_captives_fnc_handleGetOut * * Public: No */ @@ -30,4 +30,4 @@ if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { }; [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); -}; \ No newline at end of file +}; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf index 219bd2eb60..9e9c5e1ac8 100644 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -9,7 +9,7 @@ * None * * Example: - * - + * [bob1] call ACE_captives_fnc_handleKilled * * Public: No */ @@ -24,3 +24,7 @@ if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then { if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { _oldUnit setVariable [QGVAR(isEscorting), false, true]; }; + +if (_oldUnit getVariable [QGVAR(isSurrendering), false]) then { + _oldUnit setVariable [QGVAR(isSurrendering), false, true]; +}; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index af6472c211..9c4f02546f 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * TODO + * [bob1, bob2] call ACE_captives_fnc_handlePlayerChange * * Public: No */ @@ -18,7 +18,7 @@ PARAMS_2(_newUnit,_oldUnit); -if (_newUnit getVariable [QGVAR(isHandcuffed), false]) then { +if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then { showHUD false; } else { showHUD true; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index 635d7b0439..1a5a8f2ecd 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -9,7 +9,7 @@ * The return value * * Example: - * TODO + * [bob] call ACE_captives_fnc_handleUnitInitPost * * Public: No */ diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf index af59b5c56e..9bf2e1a2bc 100644 --- a/addons/captives/functions/fnc_handleWokeUp.sqf +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -9,7 +9,7 @@ * The return value * * Example: - * TODO + * [bob] call ACE_captives_fnc_handleWokeUp * * Public: No */ diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 1be72ca7c9..cf03704a85 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -10,7 +10,7 @@ * Nothing * * Example: - * TODO + * [bob, true] call ACE_captives_fnc_setHandcuffed; * * Public: No */ diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index bb782d85da..8b9d870cd5 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -10,7 +10,7 @@ * Nothing * * Example: - * TODO + * [Pierre, true] call ACE_captives_fnc_surrender; * * Public: No */ @@ -19,12 +19,18 @@ PARAMS_2(_unit,_state); if (_state) then { - if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith {}; + if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith { + ERROR("Already Surrendering"); + }; _unit setVariable [QGVAR(isSurrendering), true, true]; [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); + if (_unit == ACE_player) then { + showHUD false; + }; + private "_surrenderFnc"; _surrenderFnc = { EXPLODE_1_PVT((_this select 0),_unit); @@ -49,7 +55,7 @@ if (_state) then { }; [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); - + if (_unit == ACE_player) then { //only enable if not handcuffed if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf index dd3b6e6818..626a0b34e4 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -10,7 +10,7 @@ * Nothing * * Example: - * TODO + * [bob, car1] call ACE_captives_fnc_vehicleCaptiveMoveIn; * * Public: No */ @@ -24,5 +24,3 @@ _target moveInCargo _vehicle; _target assignAsCargo _vehicle; _cargoIndex = _vehicle getCargoIndex _target; _target setVariable [QGVAR(CargoIndex), _cargoIndex, true]; - -TRACE_3("moveinEH",_target,_vehicle,_cargoIndex); diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf index 4210e8da15..5ef6f01406 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf @@ -9,7 +9,7 @@ * Nothing * * Example: - * TODO + * [bob] call ACE_captives_fnc_vehicleCaptiveMoveOut; * * Public: No */ @@ -21,4 +21,4 @@ _unit setVariable [QGVAR(CargoIndex), -1, true]; moveOut _unit; [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); -unassignVehicle _unit; \ No newline at end of file +unassignVehicle _unit; From ed3f28ec6d1633a48ee3bc41a37f8497fb5719b6 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 6 Feb 2015 22:24:27 -0600 Subject: [PATCH 13/16] Minor Cleanup --- addons/captives/CfgMoves.hpp | 2 +- .../functions/fnc_canEscortCaptive.sqf | 4 +- .../captives/functions/fnc_canFriskPerson.sqf | 1 + .../captives/functions/fnc_setHandcuffed.sqf | 35 +++++++-------- addons/captives/functions/fnc_surrender.sqf | 45 ++++++++++++------- 5 files changed, 49 insertions(+), 38 deletions(-) diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index bb6b8669e0..288d153d7b 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -70,7 +70,7 @@ class CfgMovesMaleSdr: CfgMovesBasic { InterpolateTo[] = {"Unconscious",0.01}; }; class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - speed = 0.4; //for gameplay reasons, slow this down + speed = 0.333; //for gameplay reasons, slow this down actions = "CivilStandActions"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index cbb098881f..85bd8bbd3e 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -18,9 +18,9 @@ PARAMS_2(_unit,_target); -//Alive, handcuffed, not being escored, and not unconsious +//Alive, handcuffed, not being escored, and not unconscious (_target getVariable [QGVAR(isHandcuffed), false]) && {isNull (attachedTo _target)} && {alive _target} && -{!(_target getVariable [QGVAR(ACE_isUnconscious), false])} +{!(_target getVariable ["ACE_isUnconscious", false])} diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf index 28a9ee0134..5eecc453d4 100644 --- a/addons/captives/functions/fnc_canFriskPerson.sqf +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -19,5 +19,6 @@ PARAMS_2(_unit,_target); _target getVariable [QGVAR(isHandcuffed), false] +|| {_target getVariable [QGVAR(isSurrendering), false]} || {_target getVariable ["ACE_isSearchable", false]} || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index cf03704a85..912b00662f 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -1,6 +1,6 @@ /* * Author: Nic547, commy2 - * Handcuffs a unit + * Handcuffs a unit. * * Arguments: * 0: Unit @@ -18,39 +18,38 @@ PARAMS_2(_unit,_state); - -if (!local _unit) exitWith { - ERROR("setHandcuffed unit not local"); +// We only want this function to work on local machines +if (!local _unit) exitwith { + [_this, QUOTE(FUNC(setHandcuffed)), _unit] call EFUNC(common,execRemoteFnc); + TRACE_2("running setHandcuffed on remote unit",_unit,_state); }; -if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) exitWith { - ERROR("new state equals current"); +if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) then { + LOG("setHandcuffed: current state same as new"); }; if (_state) then { _unit setVariable [QGVAR(isHandcuffed), true, true]; [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); - - // fix anim on mission start (should work on dedicated servers) - _fixAnimationFnc = { - PARAMS_1(_unit); - if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { - [_unit] call EFUNC(common,fixLoweredRifleAnimation); - [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); - }; - }; - - [_fixAnimationFnc, [_unit], 0.05, 0] call EFUNC(common,waitAndExecute); - _unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true]; if (_unit == ACE_player) then { showHUD false; }; + + // fix anim on mission start (should work on dedicated servers) + [{ + PARAMS_1(_unit); + if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); + }; + }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); if ((vehicle _unit) == _unit) then { + //Break out of hands up animation loop (doAnimation handles Unconscious prioity) [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 8b9d870cd5..1f0e232926 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -18,46 +18,57 @@ PARAMS_2(_unit,_state); -if (_state) then { - if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith { - ERROR("Already Surrendering"); - }; +// We only want this function to work on local machines +if (!local _unit) exitwith { + [_this, QUOTE(FUNC(surrender)), _unit] call EFUNC(common,execRemoteFnc); + TRACE_2("running surrender on remote unit",_unit,_state); +}; +if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) then { + LOG("Surrender: current state same as new"); +}; + +if (_state) then { _unit setVariable [QGVAR(isSurrendering), true, true]; [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); - [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); if (_unit == ACE_player) then { showHUD false; }; - private "_surrenderFnc"; - _surrenderFnc = { - EXPLODE_1_PVT((_this select 0),_unit); + // fix anim on mission start (should work on dedicated servers) + [{ + PARAMS_1(_unit); + if (_unit getVariable [QGVAR(isSurrendering), false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); + }; + }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); + //PFEH - (TODO: move to event system?) + [{ + EXPLODE_1_PVT((_this select 0),_unit); if (_unit getVariable [QGVAR(isSurrendering), false]) then { + //If unit dies, gets knocked out, or is handcuffed then end surrender if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then { [_unit, false] call FUNC(surrender); - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [(_this select 1)] call CBA_fnc_removePerFrameHandler; }; } else { [(_this select 1)] call cba_fnc_removePerFrameHandler; }; - }; - [_surrenderFnc, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; + }, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; } else { _unit setVariable [QGVAR(isSurrendering), false, true]; + [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); - if !(_unit getVariable ["ACE_isUnconscious", false]) then { - //Break out of hands up animation loop - //don't want to step on animations from medical (TODO: testing medical integration) + if ((vehicle _unit) == _unit) then { + //Break out of hands up animation loop (doAnimation handles Unconscious prioity) [_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; - [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); - if (_unit == ACE_player) then { - //only enable if not handcuffed + //only re-enable HUD if not handcuffed if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { showHUD true; }; From fcf39a39164eeef998f71a1ee1582b937a32c515 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 6 Feb 2015 23:23:33 -0600 Subject: [PATCH 14/16] #118 Sound Effect from CSE --- .../captives/functions/fnc_doApplyHandcuffs.sqf | 3 +++ addons/captives/sounds/cable_tie_zipping.ogg | Bin 0 -> 17543 bytes 2 files changed, 3 insertions(+) create mode 100644 addons/captives/sounds/cable_tie_zipping.ogg diff --git a/addons/captives/functions/fnc_doApplyHandcuffs.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf index 8abf8c836c..0d15f503e8 100644 --- a/addons/captives/functions/fnc_doApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -19,4 +19,7 @@ PARAMS_2(_unit,_target); _unit removeItem "ACE_CableTie"; + +playSound3D [QUOTE(PATHTO_R(sounds\cable_tie_zipping.ogg)), objNull, false, (getPosASL _target), 1, 1, 10]; + ["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent); diff --git a/addons/captives/sounds/cable_tie_zipping.ogg b/addons/captives/sounds/cable_tie_zipping.ogg new file mode 100644 index 0000000000000000000000000000000000000000..4f76037eb1cd1809e68c2d977e17aedcc759f18e GIT binary patch literal 17543 zcmeIZc{r5c`#Ap07-KM)VKCOl7#ds62uYTiF?PxxD$Ag($xf*TLt_mgNoC*nP$5nB zNC<@%ilR+Qd*b(~*XR9vzdzUay1t+5`hNfVUB5GD&T^mo-1j;6x$krC=gc$vj~=xH zpuj)jo|@9>tzr+-xdr#tt$`od>MTfnU!MZ;vqFpkr=fzJcC)>Ljv;8kwv{ z(!`N9bTrj8wZ@utiUJ_v4$K#k+fOm-7F%PhhT@VO0{R@!=8@-Qt z26=gh=z-ikL2hJ_8yOei%lJDE6o?V%;TII*#s~rX=mj3vP#4;Q`5psd5#Ax8;9&Gf zk|4-4DDXHqHb#K=U)<0wWU_B)P#}c+FEJ&Wp(6x9000wjiS1>MWjFu;$e^%xckao- zTi>3YjIA`moMdm67HUn#POxu+rIlM1k|&2jSSU`zOB4WL08y?GwbqJ?)($l8@(l2gn%1$CB7&s)=Yl}fG6m8(j#ZOzplx`eLW;&~eSf%+ZCLeW4X|CRii2M!zy z2=w{`+@k!K-rs5A0469Bz$_Cp+$23REJWBbfiPunKc&;!cwNrR_JX@-Btm-?LN@a9?7fAoRY{(8a#Oi(~nr z_sx*`Wq(W2!k2jJsvdwaiKPO;ehCi{&-Xz-Pt}YQ*w=Y1|5fEp3|LCazO=pdru|=f ze~5Pr0%* zD_MDnc;B#`szw({T@^Qvet(#DrKO8E0z7V zC~#46UKv!l#2@=e%nJdnqA-r{-xqF`Fp8EL|F<~$Q5sa{zxw<~nH>&91Ug>`e|$aR z@O1dxqf>K_(%i%oy`6LaBmSK_I1^yYoc@?&HY1fhP!PY5#`|}H|FImCV9Y?K^xaH? zMKi(bf$G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s zeO?^>GrTkC_2Z{zLcU4;YsuQT>E9?whPJII5;$60l%^BgQ#DVYK0Ppy41%hwmtGEE*y+|4^W)RYVdb?A!Or(J z2O1(GBfp&i5l;ZuKmt0s(Z8b4d?T%XT_GD71aVEQcS2XcZfphFf%Wxu-PMha9h^0= d#sh*^?mYhW>(^dj^w+Nro)2IM9(xt|{{T~b6N~@= literal 0 HcmV?d00001 From 6d534e88466dfce5414f4522666600fe3fbdaadb Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 7 Feb 2015 15:20:51 -0600 Subject: [PATCH 15/16] #130 - Surrender Module Prototype --- addons/captives/CfgVehicles.hpp | 30 +++++++++++- addons/captives/XEH_preInit.sqf | 1 + addons/captives/config.cpp | 2 +- .../functions/fnc_handlePlayerChanged.sqf | 6 ++- .../functions/fnc_moduleSurrender.sqf | 46 +++++++++++++++++++ 5 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 addons/captives/functions/fnc_moduleSurrender.sqf diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 934e1215d2..d292402bcf 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -78,7 +78,7 @@ class CfgVehicles { showDisabled = 0; priority = 2.3; hotkey = "C"; - }; + }; class ACE_StartSurrenderingSelf { displayName = "$STR_ACE_Captives_StartSurrendering"; condition = QUOTE([ARR_2(_player, true)] call FUNC(canSurrender)); @@ -86,7 +86,7 @@ class CfgVehicles { exceptions[] = {}; showDisabled = 0; priority = 0; - }; + }; class ACE_StopSurrenderingSelf { displayName = "$STR_ACE_Captives_StopSurrendering"; condition = QUOTE([ARR_2(_player, false)] call FUNC(canSurrender)); @@ -162,4 +162,30 @@ class CfgVehicles { MACRO_ADDITEM(ACE_CableTie,12) }; }; + + + class Logic; + class Module_F: Logic { + class ArgumentsBaseUnits {}; + class ModuleDescription {}; + }; + + class GVAR(ModuleSurrender): Module_F { + author = "$STR_ACE_Common_ACETeam"; + category = "ACE"; + displayName = "Make Unit Surrender"; + function = QUOTE(DFUNC(moduleSurrender)); + scope = 2; //show in editor + scopeCurator = 2; //show in zeus + curatorCost = 0; //??? + isGlobal = 1; //run global + isTriggerActivated = 1; //Wait for triggers + // icon = QUOTE(PATHTOF(ui\todo.paa)); + functionPriority = 0; + class Arguments {}; + class ModuleDescription: ModuleDescription { + description = "Sync a unit to make them surrender.
Source: ace_captives"; + sync[] = {"AnyAI"}; + }; + }; }; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index a98bf73443..75ee77e9bc 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -23,6 +23,7 @@ PREP(handleKnockedOut); PREP(handlePlayerChanged); PREP(handleUnitInitPost); PREP(handleWokeUp); +PREP(moduleSurrender); PREP(setHandcuffed); PREP(surrender); PREP(vehicleCaptiveMoveIn); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index c0a34e3222..27b7c4ec60 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -2,7 +2,7 @@ class CfgPatches { class ADDON { - units[] = {}; + units[] = {QGVAR(ModuleSurrender)}; weapons[] = {"ACE_CableTie"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ACE_Interaction"}; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index 9c4f02546f..13e284ef80 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -18,8 +18,10 @@ PARAMS_2(_newUnit,_oldUnit); -if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then { - showHUD false; +if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then { + TRACE_1("Player Change (showHUD false)",_newUnit); + showHUD false; } else { + TRACE_1("Player Change (showHUD true)",_newUnit); showHUD true; }; diff --git a/addons/captives/functions/fnc_moduleSurrender.sqf b/addons/captives/functions/fnc_moduleSurrender.sqf new file mode 100644 index 0000000000..5cbf43aacc --- /dev/null +++ b/addons/captives/functions/fnc_moduleSurrender.sqf @@ -0,0 +1,46 @@ +/* + * Author: PabstMirror + * Module Function to make a unit surrender (can be called from editor, or placed with zeus) + * + * Arguments: + * 0: The Module Logic Object + * 1: synced objects + * 2: Activated + * + * Return Value: + * Nothing + * + * Example: + * Called from module + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_logic,_units,_activated); + +if (!_activated) exitWith {}; + +if (local _logic) then { + if ((!isnull curatorcamera) && {((count curatorMouseOver) == 2) && {(curatorMouseOver select 1) == _logic}}) then {//in zeus interface and we placed the module + _bisMouseOver = missionNamespace getVariable ["bis_fnc_curatorObjectPlaced_mouseOver", []];//bis caches the previous curatorMouseOver + if ((count _bisMouseOver) == 2) then {//check what mouse was over before the module was placed + _mouseOverObject = _bisMouseOver select 1; + if ((_mouseOverObject isKindOf "CAManBase") && {(vehicle _mouseOverObject) == _mouseOverObject}) then { + systemChat format ["Debug - module surrendering %1", (name _mouseOverObject)]; + [_mouseOverObject, true] call FUNC(surrender); + } else { + systemChat format ["Only use on dismounted inf"]; + }; + } else { + systemChat format ["Nothing under mouse"]; + }; + } else {//an editor module + { + systemChat format ["Debug - module surrendering %1", (name _x)]; + [_x, true] call FUNC(surrender); + } forEach _units; + }; + + deleteVehicle _logic; +}; From b3f68467bb7d7f396623851897eb251484b47a34 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 9 Feb 2015 23:33:50 -0600 Subject: [PATCH 16/16] Wrong Actions in CfgMoves --- addons/captives/CfgMoves.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index 288d153d7b..6e67f3615b 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -7,14 +7,16 @@ class CfgMovesBasic { stop = "ACE_AmovPercMstpScapWnonDnon"; StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; default = "ACE_AmovPercMstpScapWnonDnon"; + PutDown = ""; getOver = ""; throwPrepare = ""; throwGrenade[] = {"","Gesture"}; }; class ACE_CivilStandSurrenderActions: ACE_CivilStandHandcuffedActions { - stop = "ACE_AmovPercMstpScapWnonDnon"; - StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; - default = "ACE_AmovPercMstpScapWnonDnon"; + stop = "ACE_AmovPercMstpSsurWnonDnon"; + StopRelaxed = "ACE_AmovPercMstpSsurWnonDnon"; + default = "ACE_AmovPercMstpSsurWnonDnon"; + PutDown = ""; }; }; };