From 9930a884357f2bdc938060395ea46eb3bf7a1e23 Mon Sep 17 00:00:00 2001 From: Mike-MF Date: Mon, 6 Jan 2025 01:09:21 +0000 Subject: [PATCH 1/3] Backpack on Chest --- addons/backpack_on_chest/$PBOPREFIX$ | 1 + .../backpack_on_chest/ACE_Arsenal_Actions.hpp | 27 ++++++++ addons/backpack_on_chest/CfgEventHandlers.hpp | 17 +++++ addons/backpack_on_chest/CfgVehicles.hpp | 40 +++++++++++ addons/backpack_on_chest/README.md | 8 +++ addons/backpack_on_chest/XEH_PREP.hpp | 33 +++++++++ addons/backpack_on_chest/XEH_postInit.sqf | 46 +++++++++++++ addons/backpack_on_chest/XEH_preInit.sqf | 8 +++ addons/backpack_on_chest/XEH_preStart.sqf | 3 + addons/backpack_on_chest/config.cpp | 19 ++++++ .../functions/fnc_EHAnimDone.sqf | 33 +++++++++ .../functions/fnc_EHGetIn.sqf | 36 ++++++++++ .../functions/fnc_EHGetOut.sqf | 37 ++++++++++ .../functions/fnc_EHHandleDisconnect.sqf | 28 ++++++++ .../functions/fnc_EHKilled.sqf | 38 +++++++++++ .../functions/fnc_actionCutLoweringLine.sqf | 29 ++++++++ .../functions/fnc_actionLower.sqf | 45 ++++++++++++ .../functions/fnc_actionOnBack.sqf | 44 ++++++++++++ .../functions/fnc_actionOnChest.sqf | 32 +++++++++ .../functions/fnc_actionSwap.sqf | 53 +++++++++++++++ .../functions/fnc_addChestpack.sqf | 59 ++++++++++++++++ .../functions/fnc_addItemToChestpack.sqf | 34 ++++++++++ .../functions/fnc_addMagToChestpack.sqf | 32 +++++++++ .../functions/fnc_arsenal_onButtonClick.sqf | 42 ++++++++++++ .../functions/fnc_arsenal_opened.sqf | 56 +++++++++++++++ .../functions/fnc_arsenal_postInit.sqf | 20 ++++++ .../functions/fnc_arsenal_updateUI.sqf | 57 ++++++++++++++++ .../functions/fnc_canAddItemToChestpack.sqf | 29 ++++++++ .../functions/fnc_canCutLoweringLine.sqf | 25 +++++++ .../functions/fnc_canLower.sqf | 22 ++++++ .../functions/fnc_canMovePack.sqf | 22 ++++++ .../functions/fnc_chestpack.sqf | 25 +++++++ .../functions/fnc_chestpackContainer.sqf | 29 ++++++++ .../functions/fnc_chestpackLoadout.sqf | 26 +++++++ .../functions/fnc_chestpackToHolder.sqf | 41 +++++++++++ .../functions/fnc_chestpackVariables.sqf | 26 +++++++ .../functions/fnc_clearAllCargo.sqf | 23 +++++++ .../fnc_clearAllItemsFromChestpack.sqf | 29 ++++++++ .../functions/fnc_clearCargoBackpacks.sqf | 22 ++++++ .../functions/fnc_itemMass.sqf | 49 ++++++++++++++ .../functions/fnc_removeChestpack.sqf | 35 ++++++++++ .../functions/fnc_removeItemFromChestpack.sqf | 46 +++++++++++++ .../functions/fnc_removeMagFromChestpack.sqf | 49 ++++++++++++++ .../functions/fnc_setBackpackLoadout.sqf | 64 ++++++++++++++++++ addons/backpack_on_chest/initSettings.inc.sqf | 20 ++++++ addons/backpack_on_chest/script_component.hpp | 17 +++++ addons/backpack_on_chest/stringtable.xml | 35 ++++++++++ addons/backpack_on_chest/ui/onback_ca.paa | Bin 0 -> 5625 bytes addons/backpack_on_chest/ui/onchest_ca.paa | Bin 0 -> 5625 bytes addons/backpack_on_chest/ui/swap_ca.paa | Bin 0 -> 5625 bytes 50 files changed, 1511 insertions(+) create mode 100644 addons/backpack_on_chest/$PBOPREFIX$ create mode 100644 addons/backpack_on_chest/ACE_Arsenal_Actions.hpp create mode 100644 addons/backpack_on_chest/CfgEventHandlers.hpp create mode 100644 addons/backpack_on_chest/CfgVehicles.hpp create mode 100644 addons/backpack_on_chest/README.md create mode 100644 addons/backpack_on_chest/XEH_PREP.hpp create mode 100644 addons/backpack_on_chest/XEH_postInit.sqf create mode 100644 addons/backpack_on_chest/XEH_preInit.sqf create mode 100644 addons/backpack_on_chest/XEH_preStart.sqf create mode 100644 addons/backpack_on_chest/config.cpp create mode 100644 addons/backpack_on_chest/functions/fnc_EHAnimDone.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_EHGetIn.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_EHGetOut.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_EHHandleDisconnect.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_EHKilled.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_actionCutLoweringLine.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_actionLower.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_actionOnBack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_actionOnChest.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_actionSwap.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_addChestpack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_addItemToChestpack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_addMagToChestpack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_arsenal_onButtonClick.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_arsenal_opened.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_arsenal_postInit.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_arsenal_updateUI.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_canAddItemToChestpack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_canCutLoweringLine.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_canLower.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_canMovePack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_chestpack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_chestpackContainer.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_chestpackLoadout.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_chestpackVariables.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_clearAllCargo.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_clearAllItemsFromChestpack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_clearCargoBackpacks.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_itemMass.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_removeChestpack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_removeItemFromChestpack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_removeMagFromChestpack.sqf create mode 100644 addons/backpack_on_chest/functions/fnc_setBackpackLoadout.sqf create mode 100644 addons/backpack_on_chest/initSettings.inc.sqf create mode 100644 addons/backpack_on_chest/script_component.hpp create mode 100644 addons/backpack_on_chest/stringtable.xml create mode 100644 addons/backpack_on_chest/ui/onback_ca.paa create mode 100644 addons/backpack_on_chest/ui/onchest_ca.paa create mode 100644 addons/backpack_on_chest/ui/swap_ca.paa diff --git a/addons/backpack_on_chest/$PBOPREFIX$ b/addons/backpack_on_chest/$PBOPREFIX$ new file mode 100644 index 00000000..21b1b587 --- /dev/null +++ b/addons/backpack_on_chest/$PBOPREFIX$ @@ -0,0 +1 @@ +x\tac\addons\backpack_on_chest diff --git a/addons/backpack_on_chest/ACE_Arsenal_Actions.hpp b/addons/backpack_on_chest/ACE_Arsenal_Actions.hpp new file mode 100644 index 00000000..10804324 --- /dev/null +++ b/addons/backpack_on_chest/ACE_Arsenal_Actions.hpp @@ -0,0 +1,27 @@ +class ace_arsenal_actions { + class ADDON { + displayName = CSTRING(DisplayName); + condition = QUOTE((_this select 0) call FUNC(canMovePack) && {backpack (_this select 0) != '' || {(_this select 0) call FUNC(chestpack) != ''}}); + scopeEditor = 0; + tabs[] = {5}; + class GVAR(chestpack) { + condition = QUOTE((_this select 0) call FUNC(chestpack) != ''); + textStatement = QUOTE(getText (configFile >> 'CfgVehicles' >> (_this select 0) call FUNC(chestpack) >> 'displayName')); + }; + class GVAR(onChest) { + label = CSTRING(OnChest); + condition = QUOTE((_this select 0) call FUNC(canMovePack) && {backpack (_this select 0) != ''} && {(_this select 0) call FUNC(chestpack) == ''}); + statement = QUOTE((_this select 0) call FUNC(actionOnChest)); + }; + class GVAR(onBack) { + label = CSTRING(OnBack); + condition = QUOTE((_this select 0) call FUNC(canMovePack) && {backpack (_this select 0) == ''} && {(_this select 0) call FUNC(chestpack) != ''}); + statement = QUOTE((_this select 0) call FUNC(actionOnBack)); + }; + class GVAR(swap) { + label = CSTRING(Swap); + condition = QUOTE((_this select 0) call FUNC(canMovePack) && {backpack (_this select 0) != ''} && {(_this select 0) call FUNC(chestpack) != ''}); + statement = QUOTE((_this select 0) call FUNC(actionSwap)); + }; + }; +}; diff --git a/addons/backpack_on_chest/CfgEventHandlers.hpp b/addons/backpack_on_chest/CfgEventHandlers.hpp new file mode 100644 index 00000000..f6503c24 --- /dev/null +++ b/addons/backpack_on_chest/CfgEventHandlers.hpp @@ -0,0 +1,17 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/backpack_on_chest/CfgVehicles.hpp b/addons/backpack_on_chest/CfgVehicles.hpp new file mode 100644 index 00000000..5bb22e2e --- /dev/null +++ b/addons/backpack_on_chest/CfgVehicles.hpp @@ -0,0 +1,40 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(onChest) { + displayName = CSTRING(OnChest); + condition = QUOTE([_player] call FUNC(canMovePack) && {!(backpack _player isEqualTo '') && (([_player] call FUNC(chestpack)) isEqualTo '')}); + exceptions[] = {"isNotInside"}; + statement = QUOTE([_player] call FUNC(actionOnChest)); + showDisabled = 0; + priority = 2.5; + icon = QPATHTOF(ui\onchest_ca.paa); + }; + class GVAR(onBack) : GVAR(onChest) { + displayName = CSTRING(OnBack); + condition = QUOTE([_player] call FUNC(canMovePack) && {(backpack _player isEqualTo '') && !(([_player] call FUNC(chestpack)) isEqualTo '')}); + statement = QUOTE([_player] call FUNC(actionOnBack)); + icon = QPATHTOF(ui\onback_ca.paa); + }; + class GVAR(swap) : GVAR(onChest) { + displayName = CSTRING(Swap); + condition = QUOTE([_player] call FUNC(canMovePack) && {!(backpack _player isEqualTo '') && !(([_player] call FUNC(chestpack)) isEqualTo '')}); + statement = QUOTE([_player] call FUNC(actionSwap)); + icon = QPATHTOF(ui\swap_ca.paa); + }; + class GVAR(lower) : GVAR(onChest) { + displayName = CSTRING(lower); + condition = QUOTE([_player] call FUNC(canLower)); + statement = QUOTE([_player] call FUNC(actionLower)); + }; + class GVAR(cutLoweringLine) : GVAR(onChest) { + displayName = CSTRING(cutLoweringLine); + condition = QUOTE([_player] call FUNC(canCutLoweringLine)); + statement = QUOTE([_player] call FUNC(actionCutLoweringLine)); + }; + }; + }; + }; +}; diff --git a/addons/backpack_on_chest/README.md b/addons/backpack_on_chest/README.md new file mode 100644 index 00000000..79e72d92 --- /dev/null +++ b/addons/backpack_on_chest/README.md @@ -0,0 +1,8 @@ +# About + +Adds Backpack on Chest REDUX, with some minor reworks and optimisations + +### Authors +- [mjc4wilton](https://github.com/mjc4wilton) +- [DerZade](https://github.com/DerZade) +- [MikeMF](https://github.com/Mike-MF) diff --git a/addons/backpack_on_chest/XEH_PREP.hpp b/addons/backpack_on_chest/XEH_PREP.hpp new file mode 100644 index 00000000..c28d0194 --- /dev/null +++ b/addons/backpack_on_chest/XEH_PREP.hpp @@ -0,0 +1,33 @@ +PREP(actionCutLoweringLine); +PREP(actionLower); +PREP(actionOnBack); +PREP(actionSwap); +PREP(addChestpack); +PREP(addItemToChestpack); +PREP(addMagToChestpack); +PREP(arsenal_onButtonClick); +PREP(arsenal_opened); +PREP(arsenal_postInit); +PREP(arsenal_updateUI); +PREP(canAddItemToChestpack); +PREP(canCutLoweringLine); +PREP(canLower); +PREP(canMovePack); +PREP(chestpack); +PREP(chestpackContainer); +PREP(chestpackLoadout); +PREP(chestpackToHolder); +PREP(chestpackVariables); +PREP(clearAllCargo); +PREP(clearAllItemsFromChestpack); +PREP(clearCargoBackpacks); +PREP(EHAnimDone); +PREP(EHGetIn); +PREP(EHGetOut); +PREP(EHHandleDisconnect); +PREP(EHKilled); +PREP(itemMass); +PREP(removeChestpack); +PREP(removeItemFromChestpack); +PREP(removeMagFromChestpack); +PREP(setBackpackLoadout); diff --git a/addons/backpack_on_chest/XEH_postInit.sqf b/addons/backpack_on_chest/XEH_postInit.sqf new file mode 100644 index 00000000..7a46a3ea --- /dev/null +++ b/addons/backpack_on_chest/XEH_postInit.sqf @@ -0,0 +1,46 @@ +#include "script_component.hpp" + +[] call FUNC(arsenal_postInit); + +// Clear inventory of a container +[QGVAR(clearAllCargo), {call FUNC(clearAllCargo)}] call CBA_fnc_addEventHandler; +// Clear inventory of every backpack in a container +[QGVAR(clearCargoBackpacks), {call FUNC(clearCargoBackpacks)}] call CBA_fnc_addEventHandler; + +// Backpack classnames which will be made invisible instead of being made a chestpack. Useful for items like the vanilla legstrap. +GVAR(exceptions) = [ + "B_LegStrapBag_black_F", + "B_LegStrapBag_coyote_F", + "B_LegStrapBag_olive_F" +]; + +if (isServer) exitWith {}; + +[QGVAR(handleDisconnect), { + addMissionEventHandler ["HandleDisconnect", FUNC(EHHandleDisconnect)]; +}] call CBA_fnc_addEventHandler; + +// holding the backpack have landed +[QGVAR(checkLandedPFH), { + params ["_ropeTop", "_holder"]; + + // PFH to check when the helper object _ropeTop and the WeaponHolderSimulated + [{ + params ["_ropeTop", "_handle"]; + + if (speed _ropeTop < 1 && {((getPos _ropeTop) select 2) < 1}) exitWith { + deleteVehicle _ropeTop; + [_handle] call CBA_fnc_removePerFrameHandler; + }; + }, 0, _ropeTop] call CBA_fnc_addPerFrameHandler; + + [{ + params ["_holder", "_handle"]; + if (speed _holder < 1 && {getPos _holder # 2 < 1}) exitWith { + private _pos = getPos _holder; + _pos set [2, 0]; + _holder setPos _pos; + [_handle] call CBA_fnc_removePerFrameHandler; + }; + }, 0, _holder] call CBA_fnc_addPerFrameHandler; +}] call CBA_fnc_addEventHandler; diff --git a/addons/backpack_on_chest/XEH_preInit.sqf b/addons/backpack_on_chest/XEH_preInit.sqf new file mode 100644 index 00000000..0c98ca4d --- /dev/null +++ b/addons/backpack_on_chest/XEH_preInit.sqf @@ -0,0 +1,8 @@ +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" +#include "initSettings.inc.sqf" + +ADDON = true; diff --git a/addons/backpack_on_chest/XEH_preStart.sqf b/addons/backpack_on_chest/XEH_preStart.sqf new file mode 100644 index 00000000..02288857 --- /dev/null +++ b/addons/backpack_on_chest/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/backpack_on_chest/config.cpp b/addons/backpack_on_chest/config.cpp new file mode 100644 index 00000000..ea065d1b --- /dev/null +++ b/addons/backpack_on_chest/config.cpp @@ -0,0 +1,19 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"tac_main"}; + author = ECSTRING(main,Author); + authors[] = {"DerZade", "mjc4wilton", "MikeMF"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "ACE_Arsenal_Actions.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/backpack_on_chest/functions/fnc_EHAnimDone.sqf b/addons/backpack_on_chest/functions/fnc_EHAnimDone.sqf new file mode 100644 index 00000000..e29442b8 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_EHAnimDone.sqf @@ -0,0 +1,33 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Triggered by AnimDone-Eventhandler + * + * Arguments: + * 0: unit + * 1: animtaion + * + * Return Value: + * Nothing + * + * Example: + * _this call tac_backpack_on_chest_fnc_EHAnimDone; + * + * Public: No + */ +params ["_unit","_anim"]; + +if (isNil "_unit") exitWith { + ERROR("No proper argument(s) given."); +}; + +private _chestpack = [_unit] call FUNC(chestpackContainer); +private _chestpackClass = [_unit] call FUNC(chestpack); + +// freefall +if ((animationState _unit) find "halofreefall_" isEqualTo 0) then { + if !(_chestpackClass in GVAR(exceptions)) then { + _chestpack attachTo [_unit,[0,-0.4,0.05],"pelvis"]; + _chestpack setVectorDirAndUp [[0,0,1],[0,1,0]]; + }; +}; diff --git a/addons/backpack_on_chest/functions/fnc_EHGetIn.sqf b/addons/backpack_on_chest/functions/fnc_EHGetIn.sqf new file mode 100644 index 00000000..060be7d5 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_EHGetIn.sqf @@ -0,0 +1,36 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Triggered by GetInMan-Eventhandler + * + * Arguments: + * 0: unit + * 1: position + * 2: vehicle + * 3: turret path + * + * Return Value: + * Nothing + * + * Example: + * _this call tac_backpack_on_chest_fnc_EHGetIn; + * + * Public: No + */ +params ["_unit","_position","_veh"]; + +if (isNil "_unit" || isNil "_veh") exitWith { + ERROR("No proper argument(s) given."); +}; + +private _chestpack = [_unit] call FUNC(chestpackContainer); + +if (_veh isKindOf "ParachuteBase") then { + _chestpack attachTo [_veh, [0, -0.03, -0.5]]; + _chestpack setVectorDirAndUp [[-0.25, -1, 0], [0, 0, 1]]; + _chestpack hideObjectGlobal false; +} else { + detach _chestpack; + hideObjectGlobal _chestpack; + _chestpack setPos [-10000, -10000, -100]; +}; diff --git a/addons/backpack_on_chest/functions/fnc_EHGetOut.sqf b/addons/backpack_on_chest/functions/fnc_EHGetOut.sqf new file mode 100644 index 00000000..4d9da8bc --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_EHGetOut.sqf @@ -0,0 +1,37 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Triggered by GetOutMan-Eventhandler + * + * Arguments: + * 0: unit + * 1: position + * 2: vehicle + * 3: turret path + * + * Return Value: + * Nothing + * + * Example: + * _this call tac_backpack_on_chest_fnc_EHGetOut; + * + * Public: No + */ +params ["_unit","_position","_veh"]; + +if (isNil "_unit" || isNil "_veh") exitWith { + ERROR("No proper argument(s) given."); +}; + +private _chestpack = [_unit] call FUNC(chestpackContainer); +private _chestpackClass = [_unit] call FUNC(chestpack); + +if !(_chestpackClass in GVAR(exceptions)) then { + _chestpack attachTo [_unit, [0,-0.03,-0.5], "pelvis"]; + _chestpack setVectorDirAndUp [[-0.25,-1,0], [0,0,1]]; + _chestpack hideObjectGlobal false; +}; + +if (GVAR(walk)) then { + [_unit, "forceWalk", "BackpackOnChest", true] call ACEFUNC(common,statusEffect_set); +}; diff --git a/addons/backpack_on_chest/functions/fnc_EHHandleDisconnect.sqf b/addons/backpack_on_chest/functions/fnc_EHHandleDisconnect.sqf new file mode 100644 index 00000000..9d16a98f --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_EHHandleDisconnect.sqf @@ -0,0 +1,28 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton, MikeMF + * Triggered by HandleDisconnect-Eventhandler on Server. + * Handles deleting the chestpack of old units form disconnected players. + * + * Arguments: + * 0: unit + * + * Return Value: + * Nothing + * + * Example: + * _this call tac_backpack_on_chest_fnc_EHHandleDisconnect; + * + * Public: Yes + */ +params ["_unit", "_id", "_uid", "_name"]; + +if ([_unit] call FUNC(chestpack) isEqualTo "") exitWith {}; + +[{ + params ["_unit"]; + private _container = _unit call FUNC(chestpackContainer); + if (!alive _unit) then { + deleteVehicle _container; + }; +}, _unit, 1.5] call CBA_fnc_waitAndExecute; diff --git a/addons/backpack_on_chest/functions/fnc_EHKilled.sqf b/addons/backpack_on_chest/functions/fnc_EHKilled.sqf new file mode 100644 index 00000000..6c2c2260 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_EHKilled.sqf @@ -0,0 +1,38 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton, Ampersand + * Triggered by Killed-Eventhandler + * + * Arguments: + * 0: unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call tac_backpack_on_chest_fnc_EHKilled; + * + * Public: No + */ + +params ["_unit"]; + +private _chestpack = [_unit] call FUNC(chestpack); +private _chestpackLoadout = [_unit] call FUNC(chestpackLoadout); +private _chestpackVariables = [_unit] call FUNC(chestpackVariables); + +private _holder = createVehicle ["WeaponHolderSimulated", (getPos _unit), [], 0, "CAN_COLLIDE"]; + +// add pack +_holder addBackpackCargoGlobal [_chestpack, 1]; +private _backpack = firstBackpack _holder; + +[_backpack, _chestpackLoadout] call FUNC(setBackpackLoadout); + +// add variables +{ + _backpack setVariable [(_x select 0), (_x select 1), true]; +} forEach _chestpackVariables; + +// remove the backpack from the dead unit +[_unit] call FUNC(removeChestpack); diff --git a/addons/backpack_on_chest/functions/fnc_actionCutLoweringLine.sqf b/addons/backpack_on_chest/functions/fnc_actionCutLoweringLine.sqf new file mode 100644 index 00000000..78a7f609 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_actionCutLoweringLine.sqf @@ -0,0 +1,29 @@ +#include "..\script_component.hpp" +/* + * Author: Ampersand + * Triggered by the CutLoweringLine-action. Detaches the lowering line top + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call tac_backpack_on_chest_fnc_actionCutLoweringLine; + * + * Public: No + */ + +params ["_unit"]; +private _chute = vehicle _unit; +private _ropeTop = _chute getVariable [QGVAR(loweringLine), objNull]; +if (!isNull _ropeTop) then { + private _rope = (ropes _ropeTop) select 0; + private _holder = (ropeAttachedObjects _ropeTop) select 0; + if !(isNull _holder) then { + _holder ropeDetach _rope; + ropeDestroy _rope; + }; + _chute setVariable [QGVAR(loweringLine), nil, true]; +}; diff --git a/addons/backpack_on_chest/functions/fnc_actionLower.sqf b/addons/backpack_on_chest/functions/fnc_actionLower.sqf new file mode 100644 index 00000000..b5174548 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_actionLower.sqf @@ -0,0 +1,45 @@ +#include "..\script_component.hpp" +/* + * Author: Ampersand + * Triggered by the lower-action. Attaches chestpack to a dummy and connects dummy to parachute by rope. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call tac_backpack_on_chest_fnc_actionLower; + * + * Public: No + */ + +params ["_unit"]; + +private _chute = vehicle _unit; + +// Rope top helper, workaround parachute rope visual bug, allow cut +private _ropeTop = createVehicle ["ace_fastroping_helper", getPos _chute, [], 0, "CAN_COLLIDE"]; +_chute setVariable [QGVAR(loweringLine), _ropeTop, true]; +_ropeTop allowDamage false; +_ropeTop disableCollisionWith _chute; + +// Weapon holder with backpack +private _holder = [_unit] call FUNC(chestpackToHolder); // Chestpack to holder +_holder disableCollisionWith _chute; +_holder setPos (_chute modelToWorld [0, 1, -1]); +_holder setVelocity velocity _chute; + +private _rope = ropeCreate [ + _ropeTop, [0,0,0], + _holder, [0.1,-0.2,-0.55], + 5 +]; + +[{ + params ["_chute", "_ropeTop"]; + _ropeTop attachTo [_chute, [0,0,0]]; +}, [_chute, _ropeTop]] call CBA_fnc_execNextFrame; + +[QGVAR(checkLandedPFH), [_ropeTop, _holder]] call CBA_fnc_serverEvent; diff --git a/addons/backpack_on_chest/functions/fnc_actionOnBack.sqf b/addons/backpack_on_chest/functions/fnc_actionOnBack.sqf new file mode 100644 index 00000000..5469ff82 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_actionOnBack.sqf @@ -0,0 +1,44 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Triggered by the onBack-action. Handles all the stuff. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call tac_backpack_on_chest_fnc_actionOnBack; + * + * Public: No + */ +params ["_unit"]; + +private _chestpack = [_unit] call FUNC(chestpack); +private _chestpackLoadout = [_unit] call FUNC(chestpackLoadout); +private _chestpackVariables = [_unit] call FUNC(chestpackVariables); + +// make sure the player has a chestpack and no backpack +if ((_chestpack isEqualTo "") || (backpack _unit isNotEqualTo "")) exitWith {}; + +// add items +private _loadout = getUnitLoadout _unit; +_loadout set [5, [_chestpack, _chestpackLoadout]]; +_unit setUnitLoadout _loadout; + +/* + * prefilled versions of backpacks (ammo bearer, engineer, explosives, medic, repair, etc), can be emptied and placed in unit's backpack. + * they must each be emptied when added safe since game inventory won't let players add non-empty backpacks into their backpack + */ + +[QGVAR(clearCargoBackpacks), [backpackContainer _unit]] call CBA_fnc_globalEvent; + +// add variables +private _backpack = backpackContainer _unit; +{ + _backpack setVariable [(_x select 0), (_x select 1), true]; +} forEach _chestpackVariables; + +[_unit] call FUNC(removeChestpack); diff --git a/addons/backpack_on_chest/functions/fnc_actionOnChest.sqf b/addons/backpack_on_chest/functions/fnc_actionOnChest.sqf new file mode 100644 index 00000000..0de7b53b --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_actionOnChest.sqf @@ -0,0 +1,32 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Triggered by the onChest-action. Handles all the stuff. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call tac_backpack_on_chest_fnc_actionOnChest; + * + * Public: No + */ + +params["_unit"]; + +private _backpack = backpack _unit; +private _backpackLoad = loadBackpack _unit; +private _backpackLoadout = ((getUnitLoadout _unit) select 5) select 1; +private _backpackVariables = []; + +{ + private _val = (backpackContainer _unit) getVariable _x; + _backpackVariables pushBack [_x, _val]; +} forEach ((allVariables (backpackContainer _unit) - GVAR(VarBlacklist))); + +[_unit, _backpack, _backpackLoadout, _backpackVariables, _backpackLoad] call FUNC(addChestpack); + +removeBackpackGlobal _unit; diff --git a/addons/backpack_on_chest/functions/fnc_actionSwap.sqf b/addons/backpack_on_chest/functions/fnc_actionSwap.sqf new file mode 100644 index 00000000..8e18eba3 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_actionSwap.sqf @@ -0,0 +1,53 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Triggered by the swap-action. Handles all the stuff. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call tac_backpack_on_chest_fnc_actionSwap; + * + * Public: No + */ +params ["_unit"]; + +private _backpack = backpack _unit; +private _backpackLoad = loadBackpack _unit; +private _backpackLoadout = ((getUnitLoadout _unit) select 5) select 1; +private _backpackVariables = []; + +private _chestpack = [_unit] call FUNC(chestpack); +private _chestpackLoadout = [_unit] call FUNC(chestpackLoadout); +private _chestpackVariables = [_unit] call FUNC(chestpackVariables); + +// make sure the player has chest-pack and backpack +if ((_backpack isEqualTo "") || ([_unit] call FUNC(chestpack)) isEqualTo "") exitWith {}; + +// Backpack Variable Handling +{ + private _val = (backpackContainer _unit) getVariable _x; + _backpackVariables pushBack [_x, _val]; +} forEach ((allVariables (backpackContainer _unit) - GVAR(VarBlacklist))); + +// remove packs +[_unit] call FUNC(removeChestpack); +removeBackpackGlobal _unit; + +// add backpack loadout +private _loadout = getUnitLoadout _unit; +_loadout set [5, [_chestpack, _chestpackLoadout]]; +_unit setUnitLoadout _loadout; + +// add backpack variables +private _backpackNew = backpackContainer _unit; +{ + _backpackNew setVariable [(_x select 0), (_x select 1), true]; +} forEach _chestpackVariables; + +// add chestpack +[_unit, _backpack, _backpackLoadout, _backpackVariables, _backpackLoad] call FUNC(addChestpack); diff --git a/addons/backpack_on_chest/functions/fnc_addChestpack.sqf b/addons/backpack_on_chest/functions/fnc_addChestpack.sqf new file mode 100644 index 00000000..0045e3bb --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_addChestpack.sqf @@ -0,0 +1,59 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Adds a chestpack to a unit. If a unit already has one, the old chestpack will be ignored and will be deleted completely. + * + * Arguments: + * 0: Unit + * 1: Backpack Classname + * 2: Backpack Loadout + * 3: Backpack Variables + * + * Return Value: + * Nothing + * + * Example: + * [player, "B_Kitbag_rgr", ["FirstAidKit", 5], ["ace_gunbag_gunbagWeapon", "srifle_GM6_F"], []] call tac_backpack_on_chest_fnc_addChestpack; + * + * Public: No + */ +params ["_unit", "_chestpackClass", ["_backpackLoadout", []], ["_backpackVariables", []], ["_backpackLoad", -2]]; + +if (_backpackLoad isEqualTo -2) then { + _backpackLoad = loadBackpack _unit; +}; + +// add HandleDisconnect-EH on server if not done yet +if !(GETMVAR(GVAR(HDCEHadded),false)) then { + [QGVAR(handleDisconnect), []] call CBA_fnc_serverEvent; + GVAR(HDCEHadded) = true; + publicVariable QGVAR(HDCEHadded); +}; + +// delete existing chestpack, if there is one +if ([_unit] call FUNC(chestpack) != "") then { + [_unit] call FUNC(removeChestpack); +}; + +// add EHs +private _getInID = _unit addEventHandler ["GetInMan",FUNC(EHGetIn)]; +private _getOutID = _unit addEventHandler ["GetOutMan",FUNC(EHGetOut)]; +private _animID = _unit addEventHandler ["AnimDone",FUNC(EHAnimDone)]; +private _killedID = _unit addEventHandler ["Killed",FUNC(EHKilled)]; + +// create chestpack itself +private _chestpack = createSimpleObject [_chestpackClass, getPos _unit]; + +if (GVAR(walk)) then { + [_unit, "forceWalk", "BackpackOnChest", true] call ACEFUNC(common,statusEffect_set); +}; + +// set variable +_unit setVariable [QGVAR(chestpack), [[_chestpackClass, _chestpack], [_getInID, _getOutID, _animID, _killedID], _backpackLoadout, _backpackVariables, _backpackLoad], true]; + +// handle vehicles +if (vehicle _unit isNotEqualTo _unit) then { + [_unit, "", vehicle _unit] call FUNC(EHGetIn); +} else { + [_unit, "", objNull] call FUNC(EHGetOut); +}; diff --git a/addons/backpack_on_chest/functions/fnc_addItemToChestpack.sqf b/addons/backpack_on_chest/functions/fnc_addItemToChestpack.sqf new file mode 100644 index 00000000..bac4ce9c --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_addItemToChestpack.sqf @@ -0,0 +1,34 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Creates a new item and stores it in the soldier's chestpack. + * The item(s) won't be added, if adding them would cause an overflow of the backpack. + * + * Arguments: + * 0: Unit + * 1: Item + * + * Return Value: + * Nothing + * + * Example: + * [player,"FirstAidKit"] call tac_backpack_on_chest_fnc_addItemToChestpack; + * + * Public: No + */ +params ["_unit","_item"]; + +private _var = _unit getVariable [QGVAR(chestpack), nil]; + +// exit if there is not enough space left +if !([_unit, _item] call FUNC(canAddItemToChestpack)) exitWith {}; + +// add item +private _itemMass = [_item] call FUNC(itemMass); +private _maximumLoad = getNumber(configFile >> "CfgVehicles" >> ([_unit] call FUNC(chestpack)) >> "maximumLoad"); +private _preLoadPercent = _var select 4; +(_var select 2) pushBack [_item, 1]; +_var set [4, (_preLoadPercent + (_itemMass / _maximumLoad))]; + +// update public variable +_unit setVariable [QGVAR(chestpack), _var, true]; diff --git a/addons/backpack_on_chest/functions/fnc_addMagToChestpack.sqf b/addons/backpack_on_chest/functions/fnc_addMagToChestpack.sqf new file mode 100644 index 00000000..9f79ad15 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_addMagToChestpack.sqf @@ -0,0 +1,32 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Creates new magazine and stores it in the soldier's chestpack. Only magazines are supported. + * The purpose of this function is to ensure that magazines with a specified ammo count can be added. + * If you want to add a/multiple full magazine(s) you may want to use 'zade_boc_addItemToChestpack' instead. + * + * Arguments: + * 0: Unit + * 1: Classname + * 2: Ammo count + * 3: Quanitity (Optional) + * + * Return Value: + * Nothing + * + * Example: + * [player,"30Rnd_556x45_Stanag",25] call zade_boc_fnc_addMagToChestpack; + * + * Public: No + */ +params ["_unit","_item","_ammo", ["_quantity", 1]]; + +// exit if there is not enough space left +if !([_unit, _item, _quantity] call FUNC(canAddItemToChestpack)) exitWith {}; + +private _var = _unit getVariable [QGVAR(chestpack), nil]; + +(_var select 2) pushBack [_item, _quantity, _ammo]; + +// update variable +_unit setVariable [QGVAR(chestpack), _var, true]; diff --git a/addons/backpack_on_chest/functions/fnc_arsenal_onButtonClick.sqf b/addons/backpack_on_chest/functions/fnc_arsenal_onButtonClick.sqf new file mode 100644 index 00000000..e2e1252c --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_arsenal_onButtonClick.sqf @@ -0,0 +1,42 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Triggered by the onButtonClick-EventHandler. + * + * Arguments: + * None + * + * Return Value: + * Nothing + * + * Example: + * [] call tac_backpack_on_chest_fnc_arsenal_onButtonClick; + * + * Public: No + */ +private _center = missionNamespace getVariable ["BIS_fnc_arsenal_center", player]; + +private _chestpack = [_center] call FUNC(chestpack); +private _backpack = backpack _center; + +private _action = ["onback", "onchest"] select (_chestpack isEqualTo ""); + +if ((_backpack isNotEqualTo "") && (_chestpack isNotEqualTo "")) then { + _action = "swap"; +}; + +// execute action +switch (_action) do { + case ("onback"): { + [_center] call FUNC(actionOnBack); + }; + case ("onchest"): { + [_center] call FUNC(actionOnChest); + }; + case ("swap"): { + [_center] call FUNC(actionSwap); + }; +}; + +// update arsenal +["ListSelectCurrent"] call BIS_fnc_arsenal; diff --git a/addons/backpack_on_chest/functions/fnc_arsenal_opened.sqf b/addons/backpack_on_chest/functions/fnc_arsenal_opened.sqf new file mode 100644 index 00000000..fd02586e --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_arsenal_opened.sqf @@ -0,0 +1,56 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Called by XEH_postInit. Creates button. + * + * Arguments: + * 0: Arsenal Display + * + * Return Value: + * Nothing + * + * Example: + * [_disp] call tac_backpack_on_chest_fnc_arsenal_opened; + * + * Public: No + */ +params ["_display"]; + +// exit if BOC is disabled +if (GVAR(disabled)) exitWith {}; + +// get lowest button that is hidden +private _notshown = 948; +for "_i" from 948 to 945 step -1 do { + if !(ctrlShown (_display displayCtrl _i)) then { + _notshown = _i; + }; +}; + +// default offset of two buttons +private _offset = ((ctrlPosition (_display displayCtrl 932)) select 1) - ((ctrlPosition (_display displayCtrl 930)) select 1); + +private _btn = _display ctrlCreate ["RscButtonArsenal", 9233]; + +// set pos +private _pos = ctrlPosition (_display displayCtrl (_notshown - 1)); +_pos set [1, (_pos select 1) + _offset]; +_btn ctrlSetPosition _pos; +_btn ctrlCommit 0; + +// set color +_btn ctrlSetBackgroundColor [0,0,0,0.5]; + +// add EH to backpack list and to newly created button +(_display displayCtrl 965) ctrlAddEventHandler ["LBSelChanged",FUNC(arsenal_updateUI)]; +_btn ctrlAddEventHandler ["ButtonClick",FUNC(arsenal_onButtonClick)]; + +// this is for hiding the button when the rest of the ui is hidden (e.g. by pressing BACKSPACE) +_display displayAddEventHandler ["KeyDown", + "0 = _this spawn {sleep 0.02; ((_this select 0) displayCtrl 9233) ctrlShow (ctrlShown ((_this select 0) displayCtrl 932));};" +]; +_display displayAddEventHandler ["MouseButtonUp", + "0 = _this spawn {sleep 0.02; ((_this select 0) displayCtrl 9233) ctrlShow (ctrlShown ((_this select 0) displayCtrl 932));};" +]; + +[_display] call FUNC(arsenal_updateUI); diff --git a/addons/backpack_on_chest/functions/fnc_arsenal_postInit.sqf b/addons/backpack_on_chest/functions/fnc_arsenal_postInit.sqf new file mode 100644 index 00000000..99baeba9 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_arsenal_postInit.sqf @@ -0,0 +1,20 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Called by postInit. Adds local "arsenalOpened" scriptedEventhandler. + * + * Arguments: + * None + * + * Return Value: + * Nothing + * + * Example: + * [] call tac_backpack_on_chest_fnc_arsenalPostInit; + * + * Public: No + */ + +if !(hasInterface) exitWith {}; + +[missionNamespace, "arsenalOpened", FUNC(arsenal_opened)] call BIS_fnc_addScriptedEventHandler; diff --git a/addons/backpack_on_chest/functions/fnc_arsenal_updateUI.sqf b/addons/backpack_on_chest/functions/fnc_arsenal_updateUI.sqf new file mode 100644 index 00000000..66faac37 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_arsenal_updateUI.sqf @@ -0,0 +1,57 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Called when backpack of arsenal unit changes. Updates Button icon / tooltip. + * + * Arguments: + * 0: Arsenal Display + * + * Return Value: + * Nothing + * + * Example: + * [_display] call tac_backpack_on_chest_fnc_arsenal_updateUI; + * + * Public: No + */ + +disableSerialization; +params ["_display"]; + +// the onSelChanged EH calls before the actual backpack changed so we have to wait a little bit +if (_display isEqualType controlNull) exitWith { + [ctrlParent _display] spawn { + sleep 0.05; _this call FUNC(arsenal_updateUI) + }; +}; + +// the arsenal unit +private _center = missionNamespace getVariable ["BIS_fnc_arsenal_center", player]; + +private _chestpack = [_center] call FUNC(chestpack); +private _backpack = backpack _center; + +private _action = ["onBack", "onChest"] select (_chestpack isEqualTo ""); +if ((_backpack isNotEqualTo "") && (_chestpack isNotEqualTo "")) then {_action = "swap";}; + +switch (_action) do { + case ("onBack"): { + (_display displayCtrl 9233) ctrlSetText QPATHTOF(ui\onback_ca.paa); + (_display displayCtrl 9233) ctrlSetTooltip LLSTRING(onBack); + }; + case ("onChest"): { + (_display displayCtrl 9233) ctrlSetText QPATHTOF(ui\onchest_ca.paa); + (_display displayCtrl 9233) ctrlSetTooltip LLSTRING(onChest); + }; + case ("swap"): { + (_display displayCtrl 9233) ctrlSetText QPATHTOF(ui\swap_ca.paa); + (_display displayCtrl 9233) ctrlSetTooltip LLSTRING(swap); + }; +}; + +if ((_backpack isEqualTo "") && (_chestpack isEqualTo "")) then { + (_display displayCtrl 9233) ctrlEnable false; + (_display displayCtrl 9233) ctrlSetTooltip ""; +} else { + (_display displayCtrl 9233) ctrlEnable true; +}; diff --git a/addons/backpack_on_chest/functions/fnc_canAddItemToChestpack.sqf b/addons/backpack_on_chest/functions/fnc_canAddItemToChestpack.sqf new file mode 100644 index 00000000..72b9048b --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_canAddItemToChestpack.sqf @@ -0,0 +1,29 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Checks if given item can be stored into soldier's chestpack. + * + * Arguments: + * 0: Unit + * 1: Item/magazine/weapon classname + * 2: Amount (optional) + * + * Return Value: + * Can add item? + * + * Example: + * [player,"FirstAidKit",2] call tac_backpack_on_chest_fnc_canAddItemToChestpack; + * + * Public: No + */ +params ["_unit","_item",["_amount",1]]; + +private _var = _unit getVariable [QGVAR(chestpack), nil]; +private _preLoadPercent = _var select 4; + +//calculate space left in chestpack +private _maximumLoad = getNumber(configFile >> "CfgVehicles" >> ([_unit] call FUNC(chestpack)) >> "maximumLoad"); +private _remainingLoad = (1 - _preLoadPercent) * _maximumLoad; +private _itemMass = [_item] call FUNC(itemMass); + +[true, false] select ((_itemMass * _amount) > _remainingLoad); diff --git a/addons/backpack_on_chest/functions/fnc_canCutLoweringLine.sqf b/addons/backpack_on_chest/functions/fnc_canCutLoweringLine.sqf new file mode 100644 index 00000000..88c16b22 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_canCutLoweringLine.sqf @@ -0,0 +1,25 @@ +#include "..\script_component.hpp" +/* + * Author: Ampersand + * Checks if given unit can cut its lowering line + * + * Arguments: + * 0: Unit + * + * Return Value: + * Success + * + * Example: + * [_unit] call tac_backpack_on_chest_fnc_canCutLoweringLine; + * + * Public: No + */ + +params ["_unit"]; + +if (GVAR(disabled)) exitWith {false}; + +private _chute = vehicle _unit; + +_chute isKindOf "ParachuteBase" +&& {!isNull (_chute getVariable [QGVAR(loweringLine), objNull])} diff --git a/addons/backpack_on_chest/functions/fnc_canLower.sqf b/addons/backpack_on_chest/functions/fnc_canLower.sqf new file mode 100644 index 00000000..4c6eaa67 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_canLower.sqf @@ -0,0 +1,22 @@ +#include "..\script_component.hpp" +/* + * Author: Ampersand + * Checks if given unit can lower its chestpack + * + * Arguments: + * 0: Unit + * + * Return Value: + * Success + * + * Example: + * [_unit] call tac_backpack_on_chest_fnc_canLower; + * + * Public: No + */ + +params ["_unit"]; + +if (GVAR(disabled)) exitWith {false}; + +vehicle _unit isKindOf "ParachuteBase" && {[_player] call FUNC(chestpack) != ''} diff --git a/addons/backpack_on_chest/functions/fnc_canMovePack.sqf b/addons/backpack_on_chest/functions/fnc_canMovePack.sqf new file mode 100644 index 00000000..b8b28557 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_canMovePack.sqf @@ -0,0 +1,22 @@ +#include "..\script_component.hpp" +/* + * Author: Ampersand + * Checks if given unit can move its pack(s) + * + * Arguments: + * 0: Unit + * + * Return Value: + * Success + * + * Example: + * [_unit] call tac_backpack_on_chest_fnc_canMovePack; + * + * Public: No + */ + +params ["_unit"]; + +if (GVAR(disabled)) exitWith {false}; + +!(vehicle _unit isKindOf "ParachuteBase") // Can't move pack while in a parachute diff --git a/addons/backpack_on_chest/functions/fnc_chestpack.sqf b/addons/backpack_on_chest/functions/fnc_chestpack.sqf new file mode 100644 index 00000000..24970e91 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_chestpack.sqf @@ -0,0 +1,25 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Returns the classname of a unit's chestpack. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Classname + * + * Example: + * [player] call tac_backpack_on_chest_fnc_chestpack; + * + * Public: No + */ +params ["_unit"]; + +private _var = _unit getVariable [QGVAR(chestpack), nil]; + +if (isNil "_var") exitWith {""}; +private _chestpackClass = (_var select 0) select 0; + +// return classname +_chestpackClass diff --git a/addons/backpack_on_chest/functions/fnc_chestpackContainer.sqf b/addons/backpack_on_chest/functions/fnc_chestpackContainer.sqf new file mode 100644 index 00000000..15da0651 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_chestpackContainer.sqf @@ -0,0 +1,29 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Returns the cargo container of a unit's chestpack. Note that this is only a prop and does not contain any items. Items which + * were added with vanilla commands like 'addWeaponCargo' etc. will be ignored. You have to use the provided functions instead. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Cargo container or objNull + * + * Example: + * [player] call tac_backpack_on_chest_fnc_chestpackContainer; + * + * Public: No + */ +params ["_unit"]; + +if (isNil "_unit") exitWith { + ERROR("No proper argument(s) given."); +}; + +private _var = _unit getVariable [QGVAR(chestpack), nil]; +private _chestpack = (_var select 0) select 1; + +if (isNil "_var" || isNil "_chestpack") exitWith {objNull}; + +_chestpack diff --git a/addons/backpack_on_chest/functions/fnc_chestpackLoadout.sqf b/addons/backpack_on_chest/functions/fnc_chestpackLoadout.sqf new file mode 100644 index 00000000..21ddf05d --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_chestpackLoadout.sqf @@ -0,0 +1,26 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Returns Unit Loadout Array of chestpack of the given unit. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Items + * + * Example: + * [player] call tac_backpack_on_chest_fnc_chestpackLoadout; + * + * Public: No + */ +params ["_unit"]; + +private _var = _unit getVariable [QGVAR(chestpack), nil]; +private _loadout = + (_var select 2); + +// return objNull +if (isNil "_var" || isNil "_loadout") exitWith {[]}; + +// return items +_loadout diff --git a/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf b/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf new file mode 100644 index 00000000..84fd76dc --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf @@ -0,0 +1,41 @@ +#include "..\script_component.hpp" +/* + * Author: Ampersand + * Returns WeaponHolderSimulated with copy of chestpack + * + * Arguments: + * 0: Unit + * + * Return Value: + * 0: WeaponHolderSimulated + * + * Example: + * [player] call tac_backpack_on_chest_fnc_chestpackToHolder; + * + * Public: No + */ + +params ["_unit"]; + +private _chestpack = [_unit] call FUNC(chestpack); +if (_chestpack isEqualTo "") exitWith {objNull}; +private _chestpackLoadout = [_unit] call FUNC(chestpackLoadout); +private _chestpackVariables = [_unit] call FUNC(chestpackVariables); + +private _holder = createVehicle ["WeaponHolderSimulated", (getPos _unit), [], 0, "CAN_COLLIDE"]; + +// add pack +_holder addBackpackCargoGlobal [_chestpack, 1]; +private _backpack = firstBackpack _holder; + +[_backpack, _chestpackLoadout] call FUNC(setBackpackLoadout); + +// add variables +{ + _backpack setVariable [(_x select 0), (_x select 1), true]; +} forEach _chestpackVariables; + +// remove the backpack from the dead unit +[_unit] call FUNC(removeChestpack); + +_holder diff --git a/addons/backpack_on_chest/functions/fnc_chestpackVariables.sqf b/addons/backpack_on_chest/functions/fnc_chestpackVariables.sqf new file mode 100644 index 00000000..958cebbf --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_chestpackVariables.sqf @@ -0,0 +1,26 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Returns array with all variables in chestpack of the given unit. + * + * Arguments: + * 0: Unit + * + * Return Value: + * variables + * + * Example: + * [player] call tac_backpack_on_chest_fnc_chestpackVariables; + * + * Public: No + */ +params ["_unit"]; + +private _var = _unit getVariable [QGVAR(chestpack), nil]; +private _variables = + (_var select 3); + + +if (isNil "_var" || isNil "_variables") exitWith {[]}; + +// return items +_variables diff --git a/addons/backpack_on_chest/functions/fnc_clearAllCargo.sqf b/addons/backpack_on_chest/functions/fnc_clearAllCargo.sqf new file mode 100644 index 00000000..e24035b2 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_clearAllCargo.sqf @@ -0,0 +1,23 @@ +#include "..\script_component.hpp" +/* + * Author: Ampersand + * Called locally by event. Clears all the cargo of given container. + * + * Arguments: + * 0: Container + * + * Return Value: + * NONE + * + * Example: + * [_container] call tac_backpack_on_chest_fnc_clearAllCargo; + * + * Public: No + */ + +params ["_container"]; + +clearItemCargo _container; +clearWeaponCargo _container; +clearMagazineCargo _container; +clearBackpackCargo _container; diff --git a/addons/backpack_on_chest/functions/fnc_clearAllItemsFromChestpack.sqf b/addons/backpack_on_chest/functions/fnc_clearAllItemsFromChestpack.sqf new file mode 100644 index 00000000..1ee4d5f0 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_clearAllItemsFromChestpack.sqf @@ -0,0 +1,29 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade + * Removes all items (includes weapons and magazines) from a unit's chestpack. + * + * Arguments: + * 0: Unit + * 1: Clear Variables (Optional) + * + * Return Value: + * Nothing + * + * Example: + * [player] call zade_boc_fnc_clearAllItemsFromChestpack; + * + * Public: No + */ +params ["_unit", ["_variables", true]]; + +private _var = _unit getVariable [QGVAR(chestpack),nil]; +_var set [2,[]]; + +if (_variables) then { + _var set [3, []]; +}; + +_var set [4, 0]; + +_unit setVariable [QGVAR(chestpack),_var, true]; diff --git a/addons/backpack_on_chest/functions/fnc_clearCargoBackpacks.sqf b/addons/backpack_on_chest/functions/fnc_clearCargoBackpacks.sqf new file mode 100644 index 00000000..e02911f0 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_clearCargoBackpacks.sqf @@ -0,0 +1,22 @@ +#include "..\script_component.hpp" +/* + * Author: Ampersand + * Called locally by event. Clear inventory of every backpack in given container. + * + * Arguments: + * 0: Container + * + * Return Value: + * NONE + * + * Example: + * [_container] call tac_backpack_on_chest_fnc_clearCargoBackpacks; + * + * Public: No + */ + +params ["_container"]; + +{ + [_x] call FUNC(clearAllCargo); +} forEach everyBackpack _container; diff --git a/addons/backpack_on_chest/functions/fnc_itemMass.sqf b/addons/backpack_on_chest/functions/fnc_itemMass.sqf new file mode 100644 index 00000000..c843fec8 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_itemMass.sqf @@ -0,0 +1,49 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton, MikeMF + * Finds mass of given item. + * + * Arguments: + * 0: Item + * + * Return Value: + * Item mass + * + * Example: + * ["FirstAidKit"] call tac_backpack_on_chest_fnc_itemMass; + * + * Public: No + */ + +params ["_item"]; + +private _weaponConfig = configFile >> "CfgWeapons" >> _item; +private _weaponConfigItemInfo = _weaponConfig >> "ItemInfo"; + +if (isClass (_weaponConfigItemInfo)) exitWith { + getNumber (_weaponConfig >> "ItemInfo" >> "Mass"); +}; + +private _weaponConfigSlots = _weaponConfig >> "WeaponSlotsInfo"; + +if (isClass (_weaponConfigSlots)) exitWith { + getNumber (_weaponConfigSlots >> "Mass"); +}; + +private _magazineConfigMass = configFile >> "CfgMagazines" >> _item; + +if (isClass _magazineConfigMass) exitWith { + getNumber (_magazineConfigMass >> "Mass"); +}; + +private _vehiclesConfigMass = configFile >>"CfgVehicles">> _item; + +if (isClass _vehiclesConfigMass) exitWith { + getNumber (_vehiclesConfigMass >> "Mass"); +}; + +private _glassesConfigMass = configFile >> "CfgGlasses" >> _item; + +if (isClass _glassesConfigMass) exitWith { + getNumber (_glassesConfigMass >> "Mass"); +}; diff --git a/addons/backpack_on_chest/functions/fnc_removeChestpack.sqf b/addons/backpack_on_chest/functions/fnc_removeChestpack.sqf new file mode 100644 index 00000000..4cd4edfe --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_removeChestpack.sqf @@ -0,0 +1,35 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Removes unit's chestpack. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call tac_backpack_on_chest_fnc_removeChestpack; + * + * Public: No + */ +params ["_unit"]; + +private _var = _unit getVariable [QGVAR(chestpack), nil]; + +// delete chestpackContainer +deleteVehicle ([_unit] call FUNC(chestpackContainer)); + +// remove all EHs +_unit removeEventHandler ["GetInMan",(_var select 1) select 0]; +_unit removeEventHandler ["GetOutMan",(_var select 1) select 1]; +_unit removeEventHandler ["AnimDone",(_var select 1) select 2]; +_unit removeEventHandler ["Killed",(_var select 1) select 3]; + +if (GVAR(walk)) then { + [_unit, "forceWalk", "BackpackOnChest", false] call ACEFUNC(common,statusEffect_set); +}; + +// reset variable +_unit setVariable [QGVAR(chestpack), nil, true]; diff --git a/addons/backpack_on_chest/functions/fnc_removeItemFromChestpack.sqf b/addons/backpack_on_chest/functions/fnc_removeItemFromChestpack.sqf new file mode 100644 index 00000000..67f96bf0 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_removeItemFromChestpack.sqf @@ -0,0 +1,46 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Removes item from unit's chestpack. + * + * Arguments: + * 0: Unit + * 1: Item/magazine/weapon classname + * 2: Quantity (Optional) + * + * Return Value: + * Nothing + * + * Example: + * [player,"FirstAidKit"] call tac_backpack_on_chest_fnc_removeItemFromChestpack; + * + * Public: No + */ +params ["_unit","_item", ["_quantity", 1]]; + +private _loadout = _unit call FUNC(chestpackLoadout); +private _itemFound = { + if (_x find _item isNotEqualTo -1) exitWith { + [_x, _forEachIndex, true] + }; +} forEach _loadout; + +// exit if no item found +if (_itemFound select 2 isNotEqualTo true) exitWith {}; + +private _var = _unit getVariable [QGVAR(chestpack), nil]; +private _currentItem = (_var select 2) select (_itemFound select 1); +private _newQuantity = (_currentItem select 1) - _quantity; + +if (_newQuantity <= 0) then { + (_var select 2) deleteAt (_itemFound select 1); +} else { + private _newItem = +(_currentItem); + _newItem set [1, _newQuantity]; + (_var select 2) set [(_itemFound select 1), _newItem]; +}; + +_unit setVariable [QGVAR(chestpack), _var, true]; + +// return deleted item +(_itemFound select 0) diff --git a/addons/backpack_on_chest/functions/fnc_removeMagFromChestpack.sqf b/addons/backpack_on_chest/functions/fnc_removeMagFromChestpack.sqf new file mode 100644 index 00000000..cbf6da08 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_removeMagFromChestpack.sqf @@ -0,0 +1,49 @@ +#include "..\script_component.hpp" +/* + * Author: DerZade, mjc4wilton + * Removes magazine from unit's chestpack. The purpose of this function is to ensure that magazines with a specified ammo count can be removed. + * If you want to remove a magazine with just any amount of ammo you may want to use 'zade_boc_fnc_removeItemFromChestpack' instead. + * + * Arguments: + * 0: Unit + * 1: Classname + * 2: Ammo count + * 3: Quantity (Optional) + * + * Return Value: + * [MagazineClassname, Qty, Rounds] + * + * Example: + * [player,"30Rnd_556x45_Stanag",25] call tac_backpack_on_chest_fnc_removeMagFromChestpack; + * + * Public: No + */ +params ["_unit","_item","_ammo", ["_quantity", 1]]; + +private _loadout = [_unit] call FUNC(chestpackLoadout); + +private _mag = { + if ((_x select 0 isEqualTo _item) && (_x select 2 isEqualTo _ammo)) exitWith { + [_x, _forEachIndex, true]; + }; +} forEach _loadout; + +// exit if there is no such item in chestpack +if (_mag select 2 isNotEqualTo true) exitWith {}; + +private _var = _unit getVariable [QGVAR(chestpack),nil]; +private _currentMag = (_var select 2) select (_mag select 1); +private _newQuantity = (_currentMag select 1) - (_quantity); + +if (_newQuantity <= 0) then { + (_var select 2) deleteAt (_mag select 1); +} else { + private _newMag = [(_currentMag select 0), _newQuantity, (_currentMag select 2)]; + (_var select 2) set [(_mag select 1), _newMag]; +}; + +// update variable +_unit setVariable [QGVAR(chestpack),_var,true]; + +// return item. +(_mag select 0); diff --git a/addons/backpack_on_chest/functions/fnc_setBackpackLoadout.sqf b/addons/backpack_on_chest/functions/fnc_setBackpackLoadout.sqf new file mode 100644 index 00000000..bb882ff9 --- /dev/null +++ b/addons/backpack_on_chest/functions/fnc_setBackpackLoadout.sqf @@ -0,0 +1,64 @@ +#include "..\script_component.hpp" +/* + * Author: Ampersand + * Returns WeaponHolderSimulated with copy of chestpack + * + * Arguments: + * 0: Backpack + * 1: Loadout + * + * Return Value: + * 0: Success + * + * Example: + * [_backpack, (getUnitLoadout _unit) select 5 select 1] call tac_backpack_on_chest_fnc_setBackpackLoadout; + * + * Public: No + */ + +params ["_backpack", "_loadout"]; +if (isNull _backpack) exitWith {false}; + +[QGVAR(clearAllCargo), [_backpack]] call CBA_fnc_globalEvent; + +// add items +private _cfgMagazines = configFile >> "CfgMagazines"; +private _cfgVehicles = configFile >> "CfgVehicles"; +{ + if (typeName (_x select 0) == "Array") then { + // weapon with attachments + for "_i" from 1 to (_x select 1) do { + _backpack addWeaponWithAttachmentsCargoGlobal _x; + }; + } else { + private _cargoClass = (_x select 0); + if (isClass (_cfgMagazines >> _cargoClass)) then { + + _backpack addMagazineAmmoCargo _x; + // Above command sometimes fails on its own, like with PCML Missile in NATO Ammo Bearer's backpack + [{ + params ["_backpack", "_mag", "_count", "_rounds"]; + private _countInBackpack = {_x isEqualTo [_mag, _rounds]} count magazinesAmmoCargo _backpack; + if (_countInBackpack < _count) then { + _backpack addMagazineAmmoCargo [_mag, 1, _rounds]; + }; + _countInBackpack == _count + }, {}, [_backpack] + _x, 1, { + WARNING("chestpackToHolder timed out adding magazines"); + TRACE_1("Container: ",_this); + }] call CBA_fnc_waitUntilAndExecute; + + } else { + // backpacks + private _cfgCargoBackpack = _cfgVehicles >> _cargoClass; + if (isClass _cfgCargoBackpack) then { + _backpack addBackpackCargoGlobal [_cargoClass, 1]; + [QGVAR(clearCargoBackpacks), [_backpack]] call CBA_fnc_globalEvent; + } else { + _backpack addItemCargoGlobal _x; + }; + }; + }; +} forEach _loadout; + +true diff --git a/addons/backpack_on_chest/initSettings.inc.sqf b/addons/backpack_on_chest/initSettings.inc.sqf new file mode 100644 index 00000000..d4c605d1 --- /dev/null +++ b/addons/backpack_on_chest/initSettings.inc.sqf @@ -0,0 +1,20 @@ +private _category = format ["TAC %1", QUOTE(COMPONENT_BEAUTIFIED)]; +[ + QGVAR(disabled), + "CHECKBOX", + [LSTRING(Disable), LSTRING(Disable_Description)], + _category, + true, + true +] call CBA_fnc_addSetting; + +[ + QGVAR(walk), "CHECKBOX", + [LSTRING(forceWalk), LSTRING(forceWalk_Description)], + category, + true, + true +] call CBA_fnc_addSetting; + +// Blacklisted variables for mods that don't want variables to be transferred. Useful for very particular cases. +GVAR(VarBlacklist) = []; diff --git a/addons/backpack_on_chest/script_component.hpp b/addons/backpack_on_chest/script_component.hpp new file mode 100644 index 00000000..1d8f95b2 --- /dev/null +++ b/addons/backpack_on_chest/script_component.hpp @@ -0,0 +1,17 @@ +#define COMPONENT backpack_on_chest +#define COMPONENT_BEAUTIFIED Backpack On Chest +#include "\x\tac\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_BACKPACK_ON_CHEST + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_BACKPACK_ON_CHEST + #define DEBUG_SETTINGS BACKPACK_ON_CHEST +#endif + +#include "\x\tac\addons\main\script_macros.hpp" diff --git a/addons/backpack_on_chest/stringtable.xml b/addons/backpack_on_chest/stringtable.xml new file mode 100644 index 00000000..26113ae1 --- /dev/null +++ b/addons/backpack_on_chest/stringtable.xml @@ -0,0 +1,35 @@ + + + + + Disable Backpack On Chest + + + Prevent usage of Backpack on Chest features + + + Backpack on Chest + + + Lower chestpack + + + Put backpack on back + + + Put backpack on chest + + + Swap rucksacks + + + Cut lowering line + + + Force Walking + + + Force the unit to walk with backpack on chest + + + diff --git a/addons/backpack_on_chest/ui/onback_ca.paa b/addons/backpack_on_chest/ui/onback_ca.paa new file mode 100644 index 0000000000000000000000000000000000000000..62ffd457d2942f93ea506029ca978096795122a3 GIT binary patch literal 5625 zcmds5eN0nV6hE)@QJRS@2~Ai)saiKTr?@Rvon$=10%Ba&xjuslGYnkj6et-PZgULg z2e@omi5pw?L2%n2W*)WZo>M)k)i^{vufrZ=hiO=EoPJPO~;UFK_}LyYwxKM_Zn zc#+TqQ2sfbG5&dkI|FMU@%B0aW`DhVXOSfI$VAbE%}0&Hy!GO-dhS0yJ|h&0q5g^uDSpkEeK9u7O17}>P=B<_0rK>3(ViFScQH$6>JsV6zLfmqA{2|}`34Cv| zeX&6|tv{F{x&-3%D#ki?fJ)HbIsQp*sU*i0(^*}L{8v&tdK9(@R7Si4{HxuL7gjq8 z5=n1B3Ga`_!3H(DBtD)1k|kWPZDGuvcAeKpf9qKb{$gGY*stuV9_h4~^ZFK)uiDx? zBiB6sR5yT1HGcln8?79&|2&P~G?>cwj?*W(ojLLZY*?sOMdFX+UxWFV$FBhsaJ73) zUKdVb-Vemlu!iz8*IN;X`lmcGkW?nT2ob-SOL_U@>#KLYjrl^cXTkbshTCkT?H)e+ z1VI=#|C8LZoEya5Uc&N}m@(2f1@(-jx@%)6$5SN!G+H+!k@!clHE*M@mHF$D|Cs-# zjIXY4w3QcXui1rood3h|S<){Ll~pr><{Mrowfe zX4gN(@4d!9>9^rl=JWW+cucwe^)TXZ3Fezf{LB9%{BwF;Hn+KW2k{pK(GVEV$?-t^ zOQev#*(KMG&(DZ+N`n4j=&xGCaxqk1dAjZ6-$xN1%J0yZ)*qGD&+`zC7ip&xby&V- z5T#eWQ_J%w?j8)A&ygqWI6sbfB{US`gM4%MPr#ex#lSA{){Mkos{&Z!!|KPW{+;2! zx6fxY1=a`Lkw@>f&*=>0cTDipai57!pVwydItuvugVRG^Jd8w!bbSFnztB;DF--uc z>}3PL+LtKnl_Xigcg*g`i`e7(BHZrrp9zQCSw^2>4z8ynE{KU6A1Vy2rxGoY;qpJ@ zA5Je4Ugc}|jP}`r<8SIbTzZ~Q8H!o}-C6c$a)rM`iH^zp|48=lb-na@S#jc6JYx9B zEjO6`sbIXO%bO0^V*~TYf*U#`7y;-DgCa)!3xpQEnF=R_9b@O7bQGoFF{uZ`4o~d> zLr}xLP8eae$AQPLK}C-^@iO*lH@+ghY>`x9$F7I#97P%J^=Jb1B38J9cU*rA$5xB< z7<0V5;70!A)Sf{UC#8KVM-t!?!c+sC&;DLza zVa<-@U>Z%iR?(lA6KVyw&Z zA^W&3_Ce(Ye2CnDji3-;Ex>)D_5&J4Z{%gDxVDBa(xQ2h!J3^Wya;3S);HR)@iNR-F9yO%qZp4pq!mL(DQKIAil|ATo*$}VKZjAnf=+gHp6Ye%lY**c>?2o^rVWF+h zQhU4IU1b|4jAD4;sQrUOyE9f(eH8o(!~fA`7Szi77rF(3h~J?|(I*7l|IZlGpK>$-tfh8uT`R)8lSOsHtTJgZ7M s)Cxkntos7LsB9_tmOg5sh-%EJ=+F5#r0;)RzqNodJj?H|;W~i70j~^LVgLXD literal 0 HcmV?d00001 diff --git a/addons/backpack_on_chest/ui/onchest_ca.paa b/addons/backpack_on_chest/ui/onchest_ca.paa new file mode 100644 index 0000000000000000000000000000000000000000..4196023c35236b81387aebd77f0196ef2cd1ab6c GIT binary patch literal 5625 zcmdT|4NOy46h5y|pqXe*s3C#PPGIwA#%;!`(~QS3APLJl*Jm(6gSaIcp(QcHO~=5$ z;j(OXPPS~0;AS$jA2+7)nJ_1faZJ&GiAiPF08U2DG!~|_FoC;s?(OS?5<%zhPF`R8 z_1^P)&w2OUXJpyg8IH{C#Tn565DW%i=QuCpMZye;aCSy+7GViLgkQa<-@DY>#FPKv5KnHE2ZX;_n`~DGdKqg&|BSfGhnp!`qvD@uMCw+0C-H^q$6_<`^^WApu0@x$xsVe|j-B|Y`5 zuLk`O#V=Ha!?CXw*S|o_BERaqL-QdLpQZ6x`h4;0Ve`M}y`E;)TSM-0&m-;Cah=z0 z&&$(ro%b{EH%K?b)qy&%1xXv%mTD+i<8t< z^Jun$`BTZ%_a|VB$uSmGtg6QQHeky@;|}{EdxU(`q56JbeRm2WyWI?N7uEPD`bG9( zy9yO;$Y0st!ufGMqakM-_PboZ1s`w>qRfVOt2oAv$nxqr;&o$w91hCJFSLmISMqla z!ON6s!2ZBV09NwfWB{1ngY3tNUvS=n|0{N?%lZC=?klk>GWP2Hv1)l&ItfD}MY=s9 zd`PCh@&6F63lxOvIBaKx%==U?YO^4qxm0cO01gYObNw<^hd@+cr}8*wdGx&4Z>fL z?W6h|sXr2%Gi`-FY}rY#5%VQ!$&?}u%d|m8(jEFADURZ?JEUJi1D@H5kuO*&;*BL? zM1PO$6ZV1Z7;aCbzyJ{r^37 zALKVnok?20-~;B+b>?0W!T=e{vOVs2Er09|MX`bvfZi|&vf`Hr*2p+9;u!nbNws*! zu^N7?!BaaxFKpvc$FNgQR0dRhhF%rph?D+An>L3Ys|p=V1zGXyR`fs1)Kw|h3um^W ze2dXI?6EJFSC^$@;sDRfzm=a%_RTJ%wh;_bWHBcz-bw$KUbN3v=qEl!F&a76kIjzd zyGxyyY|aaG$U^ml^ygz+4tsTd{1{fQ(WBJC0_~$BVJ*Kv+34YWf+Nw$Vj= zTs|z^n2Hx+2U5u%n=@c@ar=hq$F{f!Ds+8_e;}7oI1>450(eB%uZ@UtE1yHtN7lct zq15FsbzLCtq5A8*c&e5)sgZ39ZBy|`k@^k!81Jm#dD-G?AIVUC-Nm{la%?n4L)w*t zWxm;^9VFM`h=xf)TjBcJrQ)$@NpR$zLYwmZ}w^ePZ@3ow@)&_B8Yv=lLpB$#Y zy3^HRD@-E!ye+AYLosFwoQT||W|m%lEiQ!Q8E1YBmyrX@D6v^xF}Unv53m~cPC@7~ zDJiSp%6{Ho>g4N15sTE1$~al^PCBQ4)a1(4$`&8HW6pmV)<b#(? z7V*Mu&3@^0aN_ZzkbN>XF8FZN6HzlG=7i{u+As*z9p&tc`IO9~_f@IbZKSeI)u(bk z`HsTEkG|)~q_G%gF~8ub8uiounf&d8B_RRd!U#io*?oCt*Bg!Lf2H8XSXtnyc!MGF zd)0MAbzh`;s1Dj8*RvqEaV}wGhqd$~i+4wL-u(QQcAekXDoIh0=3nUSu!VLf+^$|& zl-}2}U+hk}87pHhFAhH)X*X+x=<(+9J5VaxMco3#feesXp%(9)aFM%Zu}ISN`rPh% zhK)N`E5LJ4PC4~e%-D5Bys5*WWsLg*->9ry@h!d7Lc)BFrg)}Y&oceIXzKDdl&;72 EUwuAG1^@s6 literal 0 HcmV?d00001 diff --git a/addons/backpack_on_chest/ui/swap_ca.paa b/addons/backpack_on_chest/ui/swap_ca.paa new file mode 100644 index 0000000000000000000000000000000000000000..caa8d76c89fe585008800b0776851de550e8bea9 GIT binary patch literal 5625 zcmc&&4QyN06+X}Lv*T^Sj)P=4BuF$}B`d0CM|qynDsLt$i9n{-l8Qzu%b zbX%GwEwE%_;11{}#-dad32j=pP^k|TWsQfntUstlLUKccnm}pZv{ZGnKy0tJ@6Nf; zFV89^0OK41&nnqLBN9Kn1IubR~I7w~J= z|9_uVN4!Bb5=|e+@fAfuSSerA{y0H|ulJQP_RC`c#n!US zae29`XdRm$VheRx5E;w45!w}HSB1CbQ_jyV3U=l1L)4apTK+7l*O!LH;o(&i&ZM1C zfC|h+nA_F~r7jC&XS=~7I5aC?yxy1ZU#Uu+O_Ab>{@uv`ero4JVe7!+!I#dbknf2h z(vc9AH9lTyJUZHP_ z&DXJoD!o7DCR@&39q&k=iE?}BE-Sy4sw_7z;R`Xs^0JsQ(jQyWGghk}EGZl>GyXQ! z){66+uZIFUw5e;_bu1xf;5a}pVk@HL^Dq9nw?%I+V*5(~FXMj3^GO?8Hg|en^JILC zC5Mo|W+~sEfhR9u^KAwmi6G7z-+X+Y^!FO=wI?(F*yp-p#y`LFzzinSx1X~k_O=1U z`%)7WjV$~9?a#;0vcwS4H<@1}5x>8wN#`>X`E}%XD9ho&=t#tkqU&}0E9DO}VP`Vz zoO4BWb43)FAEom2)iD;2CNps^yZ=ow;_vtCe9ZXw z{EztC2D*aPnfW1Nfe*~EUxYK5MznxGA60`t1Ibc@FP(qWbfiP|2D=Fhf>MH})?&pK_)bzg@1i7F|0&qRI+keH@QT7>r>L`8FTQ!CU1!f#HIK zg7r8Oao|q0K91c_Qh%-IO6wo_Zr`M|R`7VQF~97}zErq(u8#Dy{TuOWPma;C`RZQn z{7$zGHkvy>`lk9*6QLfyK2W{8wvBhhlvZs$7TxllSCL4&yoK!{~X&0?AOl6VT}*wBSk%2SO?lK8NU3y zj0#h})O#iJK>SQJJ=3u?{xuVC@BWyA!Fr(jbDn3PSM?^(YSEdW|8F#wyIy}VKTX6>aPbpK@$&t zY00`iF3-Ehu6|G1wGmIwQgS<{HQ@U30b{?h4L&gBR(Nm3u5~#$!1g zG5qsuSg(O=)o|x;*0#U$m(8{KVr(!<>1t*V@84l-*OoC%iDfVmVrlJ|ObglCD~abv z$G2tlg53G0HyHJHsAMj8$-CI}3?)yRa+dZx1$68iqz2$ujE$O_({f8+IiUwc`{e8c2k7peJ zVnLba{&Al)_0N1QHH$6XWCwQ<(K7gFhR(T=-Hlfo(#foAQu(>JZmu}0T_dbz0oi_x z4Y8jZXMRh~*Nw{xNOe7wBQ;_sb z;=woJ2fDg~7nPm7zlhtafA)h|)k(eHB)^LmM*+&TY3(8dxLAp{)A(WaFf3JAxX^s~DZ4^?AZ=EoQw+;O%7eCxJvUi?GbmaQ$$OjyGDtL(%6iMCey fQwv43;);s-tX%Y+{L^>8(!v Date: Mon, 6 Jan 2025 01:18:08 +0000 Subject: [PATCH 2/3] Remove double spaces --- addons/backpack_on_chest/functions/fnc_EHKilled.sqf | 2 +- addons/backpack_on_chest/functions/fnc_addChestpack.sqf | 2 +- .../backpack_on_chest/functions/fnc_addMagToChestpack.sqf | 2 +- .../backpack_on_chest/functions/fnc_chestpackContainer.sqf | 2 +- .../backpack_on_chest/functions/fnc_chestpackToHolder.sqf | 2 +- addons/backpack_on_chest/functions/fnc_itemMass.sqf | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/backpack_on_chest/functions/fnc_EHKilled.sqf b/addons/backpack_on_chest/functions/fnc_EHKilled.sqf index 6c2c2260..de11ea94 100644 --- a/addons/backpack_on_chest/functions/fnc_EHKilled.sqf +++ b/addons/backpack_on_chest/functions/fnc_EHKilled.sqf @@ -18,7 +18,7 @@ params ["_unit"]; private _chestpack = [_unit] call FUNC(chestpack); -private _chestpackLoadout = [_unit] call FUNC(chestpackLoadout); +private _chestpackLoadout = [_unit] call FUNC(chestpackLoadout); private _chestpackVariables = [_unit] call FUNC(chestpackVariables); private _holder = createVehicle ["WeaponHolderSimulated", (getPos _unit), [], 0, "CAN_COLLIDE"]; diff --git a/addons/backpack_on_chest/functions/fnc_addChestpack.sqf b/addons/backpack_on_chest/functions/fnc_addChestpack.sqf index 0045e3bb..bed20654 100644 --- a/addons/backpack_on_chest/functions/fnc_addChestpack.sqf +++ b/addons/backpack_on_chest/functions/fnc_addChestpack.sqf @@ -4,7 +4,7 @@ * Adds a chestpack to a unit. If a unit already has one, the old chestpack will be ignored and will be deleted completely. * * Arguments: - * 0: Unit + * 0: Unit * 1: Backpack Classname * 2: Backpack Loadout * 3: Backpack Variables diff --git a/addons/backpack_on_chest/functions/fnc_addMagToChestpack.sqf b/addons/backpack_on_chest/functions/fnc_addMagToChestpack.sqf index 9f79ad15..0bbbbf4a 100644 --- a/addons/backpack_on_chest/functions/fnc_addMagToChestpack.sqf +++ b/addons/backpack_on_chest/functions/fnc_addMagToChestpack.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" /* * Author: DerZade, mjc4wilton - * Creates new magazine and stores it in the soldier's chestpack. Only magazines are supported. + * Creates new magazine and stores it in the soldier's chestpack. Only magazines are supported. * The purpose of this function is to ensure that magazines with a specified ammo count can be added. * If you want to add a/multiple full magazine(s) you may want to use 'zade_boc_addItemToChestpack' instead. * diff --git a/addons/backpack_on_chest/functions/fnc_chestpackContainer.sqf b/addons/backpack_on_chest/functions/fnc_chestpackContainer.sqf index 15da0651..993882d5 100644 --- a/addons/backpack_on_chest/functions/fnc_chestpackContainer.sqf +++ b/addons/backpack_on_chest/functions/fnc_chestpackContainer.sqf @@ -2,7 +2,7 @@ /* * Author: DerZade, mjc4wilton * Returns the cargo container of a unit's chestpack. Note that this is only a prop and does not contain any items. Items which - * were added with vanilla commands like 'addWeaponCargo' etc. will be ignored. You have to use the provided functions instead. + * were added with vanilla commands like 'addWeaponCargo' etc. will be ignored. You have to use the provided functions instead. * * Arguments: * 0: Unit diff --git a/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf b/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf index 84fd76dc..f54b8ea0 100644 --- a/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf +++ b/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf @@ -19,7 +19,7 @@ params ["_unit"]; private _chestpack = [_unit] call FUNC(chestpack); if (_chestpack isEqualTo "") exitWith {objNull}; -private _chestpackLoadout = [_unit] call FUNC(chestpackLoadout); +private _chestpackLoadout = [_unit] call FUNC(chestpackLoadout); private _chestpackVariables = [_unit] call FUNC(chestpackVariables); private _holder = createVehicle ["WeaponHolderSimulated", (getPos _unit), [], 0, "CAN_COLLIDE"]; diff --git a/addons/backpack_on_chest/functions/fnc_itemMass.sqf b/addons/backpack_on_chest/functions/fnc_itemMass.sqf index c843fec8..75b5d204 100644 --- a/addons/backpack_on_chest/functions/fnc_itemMass.sqf +++ b/addons/backpack_on_chest/functions/fnc_itemMass.sqf @@ -4,7 +4,7 @@ * Finds mass of given item. * * Arguments: - * 0: Item + * 0: Item * * Return Value: * Item mass @@ -38,12 +38,12 @@ if (isClass _magazineConfigMass) exitWith { private _vehiclesConfigMass = configFile >>"CfgVehicles">> _item; -if (isClass _vehiclesConfigMass) exitWith { +if (isClass _vehiclesConfigMass) exitWith { getNumber (_vehiclesConfigMass >> "Mass"); }; private _glassesConfigMass = configFile >> "CfgGlasses" >> _item; -if (isClass _glassesConfigMass) exitWith { +if (isClass _glassesConfigMass) exitWith { getNumber (_glassesConfigMass >> "Mass"); }; From a1798054089234b9d2af243ade4deedff9f553e0 Mon Sep 17 00:00:00 2001 From: Mike-MF Date: Mon, 6 Jan 2025 01:21:12 +0000 Subject: [PATCH 3/3] Fix files with indent size of 5 for some reason --- .../functions/fnc_EHHandleDisconnect.sqf | 2 +- addons/backpack_on_chest/functions/fnc_EHKilled.sqf | 2 +- .../backpack_on_chest/functions/fnc_actionOnBack.sqf | 2 +- .../functions/fnc_chestpackToHolder.sqf | 2 +- addons/backpack_on_chest/functions/fnc_itemMass.sqf | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/backpack_on_chest/functions/fnc_EHHandleDisconnect.sqf b/addons/backpack_on_chest/functions/fnc_EHHandleDisconnect.sqf index 9d16a98f..fec274d5 100644 --- a/addons/backpack_on_chest/functions/fnc_EHHandleDisconnect.sqf +++ b/addons/backpack_on_chest/functions/fnc_EHHandleDisconnect.sqf @@ -23,6 +23,6 @@ if ([_unit] call FUNC(chestpack) isEqualTo "") exitWith {}; params ["_unit"]; private _container = _unit call FUNC(chestpackContainer); if (!alive _unit) then { - deleteVehicle _container; + deleteVehicle _container; }; }, _unit, 1.5] call CBA_fnc_waitAndExecute; diff --git a/addons/backpack_on_chest/functions/fnc_EHKilled.sqf b/addons/backpack_on_chest/functions/fnc_EHKilled.sqf index de11ea94..fb968089 100644 --- a/addons/backpack_on_chest/functions/fnc_EHKilled.sqf +++ b/addons/backpack_on_chest/functions/fnc_EHKilled.sqf @@ -31,7 +31,7 @@ private _backpack = firstBackpack _holder; // add variables { - _backpack setVariable [(_x select 0), (_x select 1), true]; + _backpack setVariable [(_x select 0), (_x select 1), true]; } forEach _chestpackVariables; // remove the backpack from the dead unit diff --git a/addons/backpack_on_chest/functions/fnc_actionOnBack.sqf b/addons/backpack_on_chest/functions/fnc_actionOnBack.sqf index 5469ff82..e39212f5 100644 --- a/addons/backpack_on_chest/functions/fnc_actionOnBack.sqf +++ b/addons/backpack_on_chest/functions/fnc_actionOnBack.sqf @@ -38,7 +38,7 @@ _unit setUnitLoadout _loadout; // add variables private _backpack = backpackContainer _unit; { - _backpack setVariable [(_x select 0), (_x select 1), true]; + _backpack setVariable [(_x select 0), (_x select 1), true]; } forEach _chestpackVariables; [_unit] call FUNC(removeChestpack); diff --git a/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf b/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf index f54b8ea0..908297fb 100644 --- a/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf +++ b/addons/backpack_on_chest/functions/fnc_chestpackToHolder.sqf @@ -32,7 +32,7 @@ private _backpack = firstBackpack _holder; // add variables { - _backpack setVariable [(_x select 0), (_x select 1), true]; + _backpack setVariable [(_x select 0), (_x select 1), true]; } forEach _chestpackVariables; // remove the backpack from the dead unit diff --git a/addons/backpack_on_chest/functions/fnc_itemMass.sqf b/addons/backpack_on_chest/functions/fnc_itemMass.sqf index 75b5d204..01b6ef45 100644 --- a/addons/backpack_on_chest/functions/fnc_itemMass.sqf +++ b/addons/backpack_on_chest/functions/fnc_itemMass.sqf @@ -21,29 +21,29 @@ private _weaponConfig = configFile >> "CfgWeapons" >> _item; private _weaponConfigItemInfo = _weaponConfig >> "ItemInfo"; if (isClass (_weaponConfigItemInfo)) exitWith { - getNumber (_weaponConfig >> "ItemInfo" >> "Mass"); + getNumber (_weaponConfig >> "ItemInfo" >> "Mass"); }; private _weaponConfigSlots = _weaponConfig >> "WeaponSlotsInfo"; if (isClass (_weaponConfigSlots)) exitWith { - getNumber (_weaponConfigSlots >> "Mass"); + getNumber (_weaponConfigSlots >> "Mass"); }; private _magazineConfigMass = configFile >> "CfgMagazines" >> _item; if (isClass _magazineConfigMass) exitWith { - getNumber (_magazineConfigMass >> "Mass"); + getNumber (_magazineConfigMass >> "Mass"); }; private _vehiclesConfigMass = configFile >>"CfgVehicles">> _item; if (isClass _vehiclesConfigMass) exitWith { - getNumber (_vehiclesConfigMass >> "Mass"); + getNumber (_vehiclesConfigMass >> "Mass"); }; private _glassesConfigMass = configFile >> "CfgGlasses" >> _item; if (isClass _glassesConfigMass) exitWith { - getNumber (_glassesConfigMass >> "Mass"); + getNumber (_glassesConfigMass >> "Mass"); };