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 e0804b8c5f..0000000000 Binary files a/addons/captives/agm_cabletie.p3d and /dev/null differ diff --git a/addons/captives/clientInit.sqf b/addons/captives/clientInit.sqf deleted file mode 100644 index bb7c5ebbb0..0000000000 --- a/addons/captives/clientInit.sqf +++ /dev/null @@ -1,3 +0,0 @@ -// by commy2 - -[missionNamespace, "playerChanged", {_this call AGM_Captives_fnc_handlePlayerChanged}] call AGM_Core_fnc_addCustomEventhandler; diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index 56b3f8bc32..7aaa310183 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -1,363 +1,28 @@ +#include "script_component.hpp" + class CfgPatches { - class AGM_Captives { - units[] = {}; - weapons[] = {"AGM_CableTie"}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core, AGM_Interaction}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"commy2", "KoffeinFlummi"}; - authorUrl = "https://github.com/commy2/"; - }; + class ADDON { + units[] = {}; + weapons[] = {"ACE_CableTie"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ACE_Interaction"}; + author[] = {"commy2", "KoffeinFlummi"}; + authorUrl = "https://github.com/commy2/"; + VERSION_CONFIG; + }; }; -class CfgFunctions { - class AGM_Captives { - class AGM_Captives { - file = "\AGM_Captives\functions"; - class canFriskPerson; - class canLoadCaptive; - class canUnloadCaptive; - class escortCaptive; - class handleGetOut; - class handleKnockedOut; - class handlePlayerChanged; - class handleWokeUp; - class initPost; - class initUnit; - class loadCaptive; - class openFriskMenu; - class setCaptive; - class surrender; - class unloadCaptive; +#include "CfgEventHandlers.hpp" + + +class ACE_Core_canInteractConditions { + class ACE_Interaction_isNotEscorting { + condition = "!(_player getVariable ['ACE_isEscorting', false])"; + }; + class ACE_Interaction_isNotCaptive { + condition = "!(_player getVariable ['ACE_isCaptive', false])"; + }; + class ACE_Interaction_isNotSurrendering { + condition = "!(_player getVariable ['ACE_isSurrender', false])"; }; - }; }; - -//release escorted captive when entering a vehicle -class Extended_GetIn_EventHandlers { - class All { - class AGM_Captives_AutoDetachCaptive { - getIn = "if (local (_this select 2) && {(_this select 2) getVariable ['AGM_isEscorting', false]}) then {(_this select 2) setVariable ['AGM_isEscorting', false, true]}"; - }; - }; -}; - -//reset captive animation after leaving vehicle -class Extended_GetOut_EventHandlers { - class All { - class AGM_Captives_LeaveVehicle { - getOut = "if (local (_this select 2) && {(_this select 2) getVariable ['AGM_isCaptive', false]}) then {_this call AGM_Captives_fnc_handleGetOut}"; - }; - }; -}; - -//reset captivity and escorting status when getting killed -class Extended_Killed_EventHandlers { - class CAManBase { - class AGM_Captives_AutoDetachCaptive { - killed = "if ((_this select 0) getVariable ['AGM_isCaptive', false]) then {(_this select 0) setVariable ['AGM_isCaptive', false, true]}; if ((_this select 0) getVariable ['AGM_isEscorting', false]) then {(_this select 0) setVariable ['AGM_isEscorting', false, true]};"; - }; - }; -}; - -//handle captive and unconsciousness state -class Extended_Init_EventHandlers { - class CAManBase { - class AGM_Captives_AutoDetachCaptive { - init = "_this call AGM_Captives_fnc_initUnit"; - }; - }; -}; - -//mission start -class Extended_InitPost_EventHandlers { - class CAManBase { - class AGM_Captives_InitPost { - init = "if (local (_this select 0)) then {_this call AGM_Captives_fnc_initPost};"; - }; - }; -}; - -class Extended_PostInit_EventHandlers { - class AGM_Captives { - clientInit = "call compile preprocessFileLineNumbers '\AGM_Captives\clientInit.sqf'"; - }; -}; - -class AGM_Core_canInteractConditions { - class AGM_Interaction_isNotEscorting { - condition = "!(_player getVariable ['AGM_isEscorting', false])"; - }; - class AGM_Interaction_isNotCaptive { - condition = "!(_player getVariable ['AGM_isCaptive', false])"; - }; - class AGM_Interaction_isNotSurrendering { - condition = "!(_player getVariable ['AGM_isSurrender', false])"; - }; -}; - -class CfgVehicles { - class Man; - class CAManBase: Man { - class AGM_Actions { - class AGM_SetCaptive { - displayName = "$STR_AGM_Captives_SetCaptive"; - distance = 4; - condition = "'AGM_CableTie' in items _player && {alive _target} && {!(_target getVariable ['AGM_isCaptive', false])}"; - statement = "player removeItem 'AGM_CableTie'; [_target, true] call AGM_Captives_fnc_setCaptive"; - showDisabled = 0; - priority = 2.4; - icon = "\AGM_Captives\UI\handcuff_ca.paa"; - hotkey = "C"; - }; - class AGM_ReleaseCaptive { - displayName = "$STR_AGM_Captives_ReleaseCaptive"; - distance = 4; - condition = "_target getVariable ['AGM_isCaptive', false] && {isNull (attachedTo _target)}"; - statement = "[_target, false] call AGM_Captives_fnc_setCaptive"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - priority = 2.4; - icon = "\AGM_Captives\UI\handcuff_ca.paa"; - hotkey = "R"; - }; - class AGM_EscortCaptive { - displayName = "$STR_AGM_Captives_EscortCaptive"; - distance = 4; - condition = "_target getVariable ['AGM_isCaptive', false] && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['AGM_isUnconscious', false])}"; - statement = "[_target, true] call AGM_Captives_fnc_escortCaptive"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = "\AGM_Captives\UI\captive_ca.paa"; - priority = 2.3; - hotkey = "E"; - }; - class AGM_StopEscorting { - displayName = "$STR_AGM_Captives_StopEscorting"; - distance = 4; - condition = "_target getVariable ['AGM_isCaptive', false] && {_target in attachedObjects _player}"; - statement = "[_target, false] call AGM_Captives_fnc_escortCaptive"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = "\AGM_Captives\UI\captive_ca.paa"; - priority = 2.3; - hotkey = "E"; - }; - class AGM_LoadCaptive { - displayName = "$STR_AGM_Captives_LoadCaptive"; - distance = 4; - condition = "[_player, _target, objNull] call AGM_Captives_fnc_canLoadCaptive"; - statement = "[_player, _target, objNull] call AGM_Captives_fnc_loadCaptive"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = "\AGM_Captives\UI\captive_ca.paa"; - priority = 2.2; - hotkey = "L"; - }; - class AGM_FriskPerson { - displayName = "$STR_AGM_Captives_FriskPerson"; - distance = 2; - condition = "[_player, _target] call AGM_Captives_fnc_canFriskPerson"; - statement = "[_player, _target] call AGM_Captives_fnc_openFriskMenu"; - showDisabled = 0; - //icon = ""; //@todo - priority = 3; - hotkey = "F"; - }; - }; - - class AGM_SelfActions { - class AGM_StopEscortingSelf { - displayName = "$STR_AGM_Captives_StopEscorting"; - condition = "(_player getVariable ['AGM_escortedUnit', objNull]) getVariable ['AGM_isCaptive', false] && {(_player getVariable ['AGM_escortedUnit', objNull]) in attachedObjects _player}"; - statement = "[_player getVariable ['AGM_escortedUnit', objNull], false] call AGM_Captives_fnc_escortCaptive;"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - priority = 2.3; - hotkey = "C"; - }; - /*class AGM_LoadCaptiveSelf { - displayName = "$STR_AGM_Captives_LoadCaptive"; - condition = "[_player, objNull, objNull] call AGM_Captives_fnc_canLoadCaptiveIntoVehicle"; - statement = "[_player, objNull, objNull] call AGM_Captives_fnc_loadCaptiveIntoVehicle"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - priority = 2.2; - hotkey = "K"; - };*/ - }; - }; - - #define MACRO_LOADUNLOADCAPTIVE \ - class AGM_Actions { \ - class AGM_LoadCaptive { \ - displayName = "$STR_AGM_Captives_LoadCaptive"; \ - distance = 4; \ - condition = "[_player, objNull, _target] call AGM_Captives_fnc_canLoadCaptive"; \ - statement = "[_player, objNull, _target] call AGM_Captives_fnc_loadCaptive"; \ - exceptions[] = {"AGM_Interaction_isNotEscorting"}; \ - showDisabled = 0; \ - priority = 1.2; \ - hotkey = "L"; \ - }; \ - class AGM_UnloadCaptive { \ - displayName = "$STR_AGM_Captives_UnloadCaptive"; \ - distance = 4; \ - condition = "[_player, _target] call AGM_Captives_fnc_canUnloadCaptive"; \ - statement = "[_player, _target] call AGM_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 AGM_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(AGM_CableTie,12) - }; - }; -}; - -class CfgWeapons { - class AGM_ItemCore; - class InventoryItem_Base_F; - - class AGM_CableTie: AGM_ItemCore { - displayName = "$STR_AGM_Captives_CableTie"; - descriptionShort = "$STR_AGM_Captives_CableTieDescription"; - model = "\AGM_Captives\agm_cabletie.p3d"; - picture = "\AGM_Captives\UI\agm_cabletie_x_ca.paa"; - scope = 2; - class ItemInfo: InventoryItem_Base_F { - mass = 1; - }; - }; -}; - -/*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}; - }; - }; -};*/ - -class CfgMovesBasic { - class Actions { - class CivilStandActions; - class AGM_CivilStandCaptiveActions: CivilStandActions { - turnL = ""; - turnR = ""; - stop = "AGM_AmovPercMstpScapWnonDnon"; - StopRelaxed = "AGM_AmovPercMstpScapWnonDnon"; - default = "AGM_AmovPercMstpScapWnonDnon"; - getOver = ""; - throwPrepare = ""; - throwGrenade[] = {"","Gesture"}; - }; - }; -}; - -class CfgMovesMaleSdr: CfgMovesBasic { - class StandBase; - class States { - class AmovPercMstpSnonWnonDnon: StandBase { - ConnectTo[] += {"AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; - }; - - class CutSceneAnimationBase; - class AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { - actions = "AGM_CivilStandCaptiveActions"; - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; - speed = 1; - looped = 0; - interpolationRestart = 2; - ConnectTo[] = {"AGM_AmovPercMstpScapWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01,"AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - }; - - class AGM_AmovPercMstpScapWnonDnon: AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; - speed = 0; - ConnectTo[] = {"AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01}; - looped = 1; - }; - - class AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: AGM_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,"AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; - }; - }; -}; - -/* -player playMove "AGM_AmovPercMstpScapWnonDnon"; -player switchMove "AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon"; -*/ diff --git a/addons/captives/functions/fn_canFriskPerson.sqf b/addons/captives/functions/fn_canFriskPerson.sqf deleted file mode 100644 index 77ad6f6446..0000000000 --- a/addons/captives/functions/fn_canFriskPerson.sqf +++ /dev/null @@ -1,21 +0,0 @@ -/* - * By: bux578 - * - * Checks the conditions for being able to frisk a unit - * - * Arguments: - * 0: caller (player) (Object) - * 1: target (Object) - * - * Return Value: - * Boolean - */ - -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; - - _target getVariable ["AGM_isCaptive", false] -|| {_target getVariable ["AGM_isSearchable", false]} -|| {_target getVariable ["AGM_isUnconscious", false]} diff --git a/addons/captives/functions/fn_canLoadCaptive.sqf b/addons/captives/functions/fn_canLoadCaptive.sqf deleted file mode 100644 index 637a4889af..0000000000 --- a/addons/captives/functions/fn_canLoadCaptive.sqf +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: commy2 - * - * Check if the unit can load 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: - * Boolean (Bool) - */ - -private ["_unit", "_target", "_vehicle", "_objects"]; - -_unit = _this select 0; -_target = _this select 1; -_vehicle = _this select 2; - -if (isNull _target) then { - _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_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 ["AGM_isEscorting", false] -&& {!isNil "_target"} -&& {!isNil "_vehicle"} -&& {_vehicle emptyPositions "cargo" > 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 0000000000..72a6facd2b Binary files /dev/null and b/addons/captives/models/ace_cabletie.p3d differ 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