From 3b94f2ba20f92d5b19d30d6da9efb2d69147b9b8 Mon Sep 17 00:00:00 2001 From: Mia <95135995+MissHeda@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:12:28 +0100 Subject: [PATCH] Misc - Add / Update - Armband NVG version integration & code cleanup (#463) - Adds new night vision variants of all armbands. - Adjusted code to save which armband (goggles or nvg) was used for sling to bone. - Code cleanup for sling file, now much more compact. --- addons/misc/CfgGlasses.hpp | 8 +- addons/misc/CfgVehicles.hpp | 219 ++++++++++++--- addons/misc/CfgWeapons.hpp | 40 +++ addons/misc/XEH_postInit.sqf | 8 +- addons/misc/XEH_preInit.sqf | 72 +++-- .../functions/fnc_checkArmbandCondition.sqf | 12 +- addons/misc/functions/fnc_slingArmband.sqf | 250 ++++-------------- addons/misc/functions/fnc_unSlingArmband.sqf | 133 ++-------- 8 files changed, 362 insertions(+), 380 deletions(-) diff --git a/addons/misc/CfgGlasses.hpp b/addons/misc/CfgGlasses.hpp index 2fcfdcc1d..b72424200 100644 --- a/addons/misc/CfgGlasses.hpp +++ b/addons/misc/CfgGlasses.hpp @@ -1,7 +1,7 @@ class CfgGlasses { class None; - class kat_armband_red_cross: None + class kat_Armband_Red_Cross_Goggles: None { author = "Miss Heda, vccv9040 (Swedish Forces Pack)"; displayname = CSTRING(Armband_Red_Cross_ItemName); @@ -13,7 +13,7 @@ class CfgGlasses identityTypes[] = {}; }; - class kat_armband_medic: kat_armband_red_cross + class kat_Armband_Medic_Goggles: kat_Armband_Red_Cross_Goggles { author= "Miss Heda, vccv9040 (Swedish Forces Pack)"; displayname = CSTRING(Armband_Medic_ItemName); @@ -21,7 +21,7 @@ class CfgGlasses picture= QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); }; - class kat_armband_doctor: kat_armband_red_cross + class kat_Armband_Doctor_Goggles: kat_Armband_Red_Cross_Goggles { author= "Miss Heda, vccv9040 (Swedish Forces Pack)"; displayname = CSTRING(Armband_Doctor_ItemName); @@ -29,7 +29,7 @@ class CfgGlasses picture= QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); }; - class kat_armband_kat: kat_armband_red_cross + class kat_Armband_Kat_Goggles: kat_Armband_Red_Cross_Goggles { author= "Miss Heda, vccv9040 (Swedish Forces Pack)"; displayname = CSTRING(Armband_Kat_ItemName); diff --git a/addons/misc/CfgVehicles.hpp b/addons/misc/CfgVehicles.hpp index 6d949c07b..9e44151e0 100644 --- a/addons/misc/CfgVehicles.hpp +++ b/addons/misc/CfgVehicles.hpp @@ -167,7 +167,7 @@ class CfgVehicles { }; }; class Items_base_F; - class Kat_armbandRC: Items_base_F { + class kat_Armband_Red_Cross_Object: Items_base_F { scope = 2; scopeCurator = 2; scopeArsenal = 2; @@ -177,20 +177,17 @@ class CfgVehicles { hiddenSelections[] = {"Armband"}; hiddenSelectionsTextures[] = {QPATHTOF(models\armband\ArmbandWC.paa)}; }; - class Kat_armbandRCM: Kat_armbandRC { - author = "Miss Heda, vccv9040 (Swedish Forces Pack)"; + class kat_Armband_Medic_Object: kat_Armband_Red_Cross_Object { editorPreview = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); model = QPATHTOF(models\armband\Armband.p3d); hiddenSelectionsTextures[] = {QPATHTOF(models\armband\ArmbandWCM.paa)}; }; - class Kat_armbandRCD: Kat_armbandRC { - author = "Miss Heda, vccv9040 (Swedish Forces Pack)"; + class kat_Armband_Doctor_Object: kat_Armband_Red_Cross_Object { editorPreview = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); model = QPATHTOF(models\armband\Armband.p3d); hiddenSelectionsTextures[] = {QPATHTOF(models\armband\ArmbandWCD.paa)}; }; - class Kat_armbandKAT: Kat_armbandRC { - author = "Miss Heda, vccv9040 (Swedish Forces Pack)"; + class kat_Armband_Kat_Object: kat_Armband_Red_Cross_Object { editorPreview = QPATHTOF(ui\ArmbandKat.paa); model = QPATHTOF(models\armband\Armband.p3d); hiddenSelectionsTextures[] = {QPATHTOF(models\armband\ArmbandKAT.paa)}; @@ -220,36 +217,72 @@ class CfgVehicles { class RedCross { displayName = CSTRING(Armband_Red_Cross_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_red_cross')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Red_Cross_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_red_cross',0)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Red_Cross_Goggles',0)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCross.paa); }; class Medic { displayName = CSTRING(Armband_Medic_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_medic')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Medic_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_medic',0)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Medic_Goggles',0)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); }; class Doctor { displayName = CSTRING(Armband_Doctor_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_doctor')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Doctor_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_doctor',0)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Doctor_Goggles',0)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); }; class Kat { displayName = CSTRING(Armband_Kat_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_kat')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Kat_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_kat',0)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Kat_Goggles',0)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandKat.paa); + }; + + class RedCross_NVG { + displayName = CSTRING(Armband_Red_Cross_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Red_Cross_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Red_Cross_NVG',0)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCross.paa); + }; + + class Medic_NVG { + displayName = CSTRING(Armband_Medic_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Medic_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Medic_NVG',0)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); + }; + + class Doctor_NVG { + displayName = CSTRING(Armband_Doctor_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Doctor_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Doctor_NVG',0)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); + }; + + class Kat_NVG { + displayName = CSTRING(Armband_Kat_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Kat_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Kat_NVG',0)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandKat.paa); }; @@ -265,36 +298,72 @@ class CfgVehicles { class RedCross { displayName = CSTRING(Armband_Red_Cross_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_red_cross')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Red_Cross_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_red_cross',1)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Red_Cross_Goggles',1)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCross.paa); }; class Medic { displayName = CSTRING(Armband_Medic_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_medic')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Medic_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_medic',1)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Medic_Goggles',1)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); }; class Doctor { displayName = CSTRING(Armband_Doctor_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_doctor')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Doctor_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_doctor',1)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Doctor_Goggles',1)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); }; class Kat { displayName = CSTRING(Armband_Kat_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_kat')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Kat_Goggles')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Kat_Goggles',1)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandKat.paa); + }; + + class RedCross_NVG { + displayName = CSTRING(Armband_Red_Cross_ItemName_NVG); + condition = QUOTE([ARR_2(_player,'kat_Armband_Red_Cross_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Red_Cross_NVG',1)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCross.paa); + }; + + class Medic_NVG { + displayName = CSTRING(Armband_Medic_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Medic_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Medic_NVG',1)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); + }; + + class Doctor_NVG { + displayName = CSTRING(Armband_Doctor_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Doctor_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Doctor_NVG',1)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); + }; + + class Kat_NVG { + displayName = CSTRING(Armband_Kat_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Kat_NVG')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_kat',1)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Kat_NVG',1)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandKat.paa); }; @@ -310,36 +379,72 @@ class CfgVehicles { class RedCross { displayName = CSTRING(Armband_Red_Cross_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_red_cross')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Red_Cross_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_red_cross',2)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Red_Cross_Goggles',2)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCross.paa); }; class Medic { displayName = CSTRING(Armband_Medic_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_medic')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Medic_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_medic',2)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Medic_Goggles',2)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); }; class Doctor { displayName = CSTRING(Armband_Doctor_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_doctor')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Doctor_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_doctor',2)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Doctor_Goggles',2)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); }; class Kat { displayName = CSTRING(Armband_Kat_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_kat')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Kat_Goggles')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Kat_Goggles',2)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandKat.paa); + }; + + class RedCross_NVG { + displayName = CSTRING(Armband_Red_Cross_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Red_Cross_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Red_Cross_NVG',2)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCross.paa); + }; + + class Medic_NVG { + displayName = CSTRING(Armband_Medic_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Medic_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Medic_NVG',2)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); + }; + + class Doctor_NVG { + displayName = CSTRING(Armband_Doctor_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Doctor_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Doctor_NVG',2)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); + }; + + class Kat_NVG { + displayName = CSTRING(Armband_Kat_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Kat_NVG')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_kat',2)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Kat_NVG',2)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandKat.paa); }; @@ -355,36 +460,72 @@ class CfgVehicles { class RedCross { displayName = CSTRING(Armband_Red_Cross_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_red_cross')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Red_Cross_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_red_cross',3)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Red_Cross_Goggles',3)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCross.paa); }; class Medic { displayName = CSTRING(Armband_Medic_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_medic')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Medic_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_medic',3)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Medic_Goggles',3)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); }; class Doctor { displayName = CSTRING(Armband_Doctor_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_doctor')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Doctor_Goggles')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_doctor',3)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Doctor_Goggles',3)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); }; class Kat { displayName = CSTRING(Armband_Kat_ItemName); - condition = QUOTE([ARR_2(_player,'kat_armband_kat')] call ACEFUNC(common,hasItem)); + condition = QUOTE([ARR_2(_player,'kat_Armband_Kat_Goggles')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Kat_Goggles',3)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandKat.paa); + }; + + class RedCross_NVG { + displayName = CSTRING(Armband_Red_Cross_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Red_Cross_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Red_Cross_NVG',3)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCross.paa); + }; + + class Medic_NVG { + displayName = CSTRING(Armband_Medic_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Medic_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Medic_NVG',3)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); + }; + + class Doctor_NVG { + displayName = CSTRING(Armband_Doctor_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Doctor_NVG')] call ACEFUNC(common,hasItem)); + exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; + statement = QUOTE([ARR_3(_player,'kat_Armband_Doctor_NVG',3)] call FUNC(slingArmband)); + showDisabled = 0; + icon = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); + }; + + class Kat_NVG { + displayName = CSTRING(Armband_Kat_ItemName); + condition = QUOTE([ARR_2(_player,'kat_Armband_Kat_NVG')] call ACEFUNC(common,hasItem)); exceptions[] = {"isNotSwimming", "isNotInside", "notOnMap", "isNotSitting"}; - statement = QUOTE([ARR_3(_player,'kat_armband_kat',3)] call FUNC(slingArmband)); + statement = QUOTE([ARR_3(_player,'kat_Armband_Kat_NVG',3)] call FUNC(slingArmband)); showDisabled = 0; icon = QPATHTOF(ui\ArmbandKat.paa); }; diff --git a/addons/misc/CfgWeapons.hpp b/addons/misc/CfgWeapons.hpp index eaf8fe8de..c3d561ec5 100644 --- a/addons/misc/CfgWeapons.hpp +++ b/addons/misc/CfgWeapons.hpp @@ -2,6 +2,7 @@ class CfgWeapons { class ToolKit; class ACE_ItemCore; + class ACE_NVGoggles_WP; class CBA_MiscItem_ItemInfo; class Attachable_Helistretcher: ToolKit { author = "Battlekeeper"; @@ -47,6 +48,45 @@ class CfgWeapons picture = QPATHTOF(ui\ArmbandKat.paa); }; + class kat_Armband_Red_Cross_NVG: ACE_NVGoggles_WP { + author = "Miss Heda, vccv9040 (Swedish Forces Pack)"; + displayName = CSTRING(Armband_Red_Cross_ItemName); + editorPreview = QPATHTOF(ui\ArmbandWhiteCross.paa); + picture = QPATHTOF(ui\ArmbandWhiteCross.paa); + model = QPATHTOF(models\armband\Armband.p3d); + hiddenSelections[] = {"Armband"}; + hiddenSelectionsTextures[] = {QPATHTOF(models\armband\ArmbandWC.paa)}; + class ItemInfo { + type = 616; + hmdType = 0; + hiddenSelections[] = {"Armband"}; + uniformModel = QPATHTOF(models\armband\Armband.p3d); + modelOff = QPATHTOF(models\armband\Armband.p3d); + mass = 3; + }; + }; + + class kat_Armband_Medic_NVG: kat_Armband_Red_Cross_NVG { + displayName = CSTRING(Armband_Medic_ItemName); + editorPreview = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); + picture = QPATHTOF(ui\ArmbandWhiteCrossMedic.paa); + hiddenSelectionsTextures[] = {QPATHTOF(models\armband\ArmbandWCM.paa)}; + }; + + class kat_Armband_Doctor_NVG: kat_Armband_Red_Cross_NVG { + displayName = CSTRING(Armband_Doctor_ItemName); + editorPreview = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); + picture = QPATHTOF(ui\ArmbandWhiteCrossDoctor.paa); + hiddenSelectionsTextures[] = {QPATHTOF(models\armband\ArmbandWCD.paa)}; + }; + + class kat_Armband_Kat_NVG: kat_Armband_Red_Cross_NVG { + displayName = CSTRING(Armband_Kat_ItemName); + editorPreview = QPATHTOF(ui\ArmbandKat.paa); + picture = QPATHTOF(ui\ArmbandKat.paa); + hiddenSelectionsTextures[] = {QPATHTOF(models\armband\ArmbandKAT.paa)}; + }; + class kat_Bubble_Wrap_Item: ACE_ItemCore { author = "Miss Heda"; displayName = CSTRING(Bubble_Wrap_Display); diff --git a/addons/misc/XEH_postInit.sqf b/addons/misc/XEH_postInit.sqf index dbe5cbe9a..9f022ae71 100644 --- a/addons/misc/XEH_postInit.sqf +++ b/addons/misc/XEH_postInit.sqf @@ -39,10 +39,10 @@ if (GVAR(incompatibilityWarning)) then { GVAR(uniqueItemsCache) = nil; }] call CBA_fnc_addPlayerEventHandler; -["kat_Armband_Red_Cross_Item", "kat_armband_red_cross"] call ACEFUNC(common,registerItemReplacement); -["kat_Armband_Medic_Item", "kat_armband_medic"] call ACEFUNC(common,registerItemReplacement); -["kat_Armband_Doctor_Item", "kat_armband_doctor"] call ACEFUNC(common,registerItemReplacement); -["kat_Armband_Kat_Item", "kat_armband_kat"] call ACEFUNC(common,registerItemReplacement); +["kat_Armband_Red_Cross_Item", "kat_Armband_Red_Cross_Goggles"] call ACEFUNC(common,registerItemReplacement); +["kat_Armband_Medic_Item", "kat_Armband_Medic_Goggles"] call ACEFUNC(common,registerItemReplacement); +["kat_Armband_Doctor_Item", "kat_Armband_Doctor_Goggles"] call ACEFUNC(common,registerItemReplacement); +["kat_Armband_Kat_Item", "kat_Armband_Kat_Goggles"] call ACEFUNC(common,registerItemReplacement); ["kat_Bubble_Wrap_Item", "kat_Bubble_Wrap"] call ACEFUNC(common,registerItemReplacement); [QGVAR(stopCarryingPrompt), LINKFUNC(stopCarryingPrompt)] call CBA_fnc_addEventHandler; diff --git a/addons/misc/XEH_preInit.sqf b/addons/misc/XEH_preInit.sqf index f04454600..e86645213 100644 --- a/addons/misc/XEH_preInit.sqf +++ b/addons/misc/XEH_preInit.sqf @@ -90,8 +90,13 @@ PREP_RECOMPILE_END; "EDITBOX", [LLSTRING(SETTING_ArmbandSlingLeftArmPos_Display), LLSTRING(SETTING_ArmbandSlingLeftArmPos_Desc)], [CBA_SETTINGS_CAT, LSTRING(SubCategory_Armband)], - "0.2, -0.39, -0.2", - 2 + "[0.2, -0.39, -0.2]", + 2, + { + private _string = missionNamespace getVariable [QGVAR(armbandSlingLeftArm), ""]; + private _array = parseSimpleArray _string; + missionNamespace setVariable [QGVAR(armbandSlingLeftArm), _array, true]; + } ] call CBA_Settings_fnc_init; //Adjust armband rotation left arm (yaw, pitch, roll) @@ -100,8 +105,13 @@ PREP_RECOMPILE_END; "EDITBOX", [LLSTRING(SETTING_ArmbandSlingLeftArmRot_Display), LLSTRING(SETTING_ArmbandSlingLeftArmRot_Desc)], [CBA_SETTINGS_CAT, LSTRING(SubCategory_Armband)], - "240, 33, 26", - 2 + "[240, 33, 26]", + 2, + { + private _string = missionNamespace getVariable [QGVAR(armbandSlingLeftArmRotation), ""]; + private _array = parseSimpleArray _string; + missionNamespace setVariable [QGVAR(armbandSlingLeftArmRotation), _array, true]; + } ] call CBA_Settings_fnc_init; //Adjust armband sling right arm (x, y, z) @@ -110,8 +120,13 @@ PREP_RECOMPILE_END; "EDITBOX", [LLSTRING(SETTING_ArmbandSlingRightArmPos_Display), LLSTRING(SETTING_ArmbandSlingRightArmPos_Desc)], [CBA_SETTINGS_CAT, LSTRING(SubCategory_Armband)], - "-0.228, -0.1, -0.43", - 2 + "[-0.228, -0.1, -0.43]", + 2, + { + private _string = missionNamespace getVariable [QGVAR(armbandSlingRightArm), ""]; + private _array = parseSimpleArray _string; + missionNamespace setVariable [QGVAR(armbandSlingRightArm), _array, true]; + } ] call CBA_Settings_fnc_init; //Adjust armband rotation right arm (yaw, pitch, roll) @@ -120,8 +135,13 @@ PREP_RECOMPILE_END; "EDITBOX", [LLSTRING(SETTING_ArmbandSlingRightArmRot_Display), LLSTRING(SETTING_ArmbandSlingRightArmRot_Desc)], [CBA_SETTINGS_CAT, LSTRING(SubCategory_Armband)], - "5, -5, -5", - 2 + "[5, -5, -5]", + 2, + { + private _string = missionNamespace getVariable [QGVAR(armbandSlingRightArmRotation), ""]; + private _array = parseSimpleArray _string; + missionNamespace setVariable [QGVAR(armbandSlingRightArmRotation), _array, true]; + } ] call CBA_Settings_fnc_init; //Adjust armband sling left leg (x, y, z) @@ -130,8 +150,13 @@ PREP_RECOMPILE_END; "EDITBOX", [LLSTRING(SETTING_ArmbandSlingLeftLegPos_Display), LLSTRING(SETTING_ArmbandSlingLeftLegPos_Desc)], [CBA_SETTINGS_CAT, LSTRING(SubCategory_Armband)], - "0.435, -0.075, -0.38", - 2 + "[0.435, -0.075, -0.38]", + 2, + { + private _string = missionNamespace getVariable [QGVAR(armbandSlingLeftLeg), ""]; + private _array = parseSimpleArray _string; + missionNamespace setVariable [QGVAR(armbandSlingLeftLeg), _array, true]; + } ] call CBA_Settings_fnc_init; //Adjust armband rotation left leg (yaw, pitch, roll) @@ -140,8 +165,13 @@ PREP_RECOMPILE_END; "EDITBOX", [LLSTRING(SETTING_ArmbandSlingLeftLegRot_Display), LLSTRING(SETTING_ArmbandSlingLeftLegRot_Desc)], [CBA_SETTINGS_CAT, LSTRING(SubCategory_Armband)], - "-160, -5, 45", - 2 + "[-160, -5, 45]", + 2, + { + private _string = missionNamespace getVariable [QGVAR(armbandSlingLeftLegRotation), ""]; + private _array = parseSimpleArray _string; + missionNamespace setVariable [QGVAR(armbandSlingLeftLegRotation), _array, true]; + } ] call CBA_Settings_fnc_init; //Adjust armband sling right leg (x, y, z) @@ -150,8 +180,13 @@ PREP_RECOMPILE_END; "EDITBOX", [LLSTRING(SETTING_ArmbandSlingRightLegPos_Display), LLSTRING(SETTING_ArmbandSlingRightLegPos_Desc)], [CBA_SETTINGS_CAT, LSTRING(SubCategory_Armband)], - "-0.32, -0.29, -0.42", - 2 + "[-0.32, -0.29, -0.42]", + 2, + { + private _string = missionNamespace getVariable [QGVAR(armbandSlingRightLeg), ""]; + private _array = parseSimpleArray _string; + missionNamespace setVariable [QGVAR(armbandSlingRightLeg), _array, true]; + } ] call CBA_Settings_fnc_init; //Adjust armband rotation right Leg (yaw, pitch, roll) @@ -160,8 +195,13 @@ PREP_RECOMPILE_END; "EDITBOX", [LLSTRING(SETTING_ArmbandSlingRightLegRot_Display), LLSTRING(SETTING_ArmbandSlingRightLegRot_Desc)], [CBA_SETTINGS_CAT, LSTRING(SubCategory_Armband)], - "-30, -5, 38", - 2 + "[-30, -5, 38]", + 2, + { + private _string = missionNamespace getVariable [QGVAR(armbandSlingRightLegRotation), ""]; + private _array = parseSimpleArray _string; + missionNamespace setVariable [QGVAR(armbandSlingRightLegRotation), _array, true]; + } ] call CBA_Settings_fnc_init; // Remove IFAK when empty diff --git a/addons/misc/functions/fnc_checkArmbandCondition.sqf b/addons/misc/functions/fnc_checkArmbandCondition.sqf index 57f14e2c8..24c8121f0 100644 --- a/addons/misc/functions/fnc_checkArmbandCondition.sqf +++ b/addons/misc/functions/fnc_checkArmbandCondition.sqf @@ -17,10 +17,14 @@ params ["_unit"]; -[_unit, "kat_armband_red_cross"] call ACEFUNC(common,hasItem) || -[_unit, "kat_armband_medic"] call ACEFUNC(common,hasItem) || -[_unit, "kat_armband_doctor"] call ACEFUNC(common,hasItem) || -[_unit, "kat_armband_kat"] call ACEFUNC(common,hasItem) || +[_unit, "kat_Armband_Red_Cross_Goggles"] call ACEFUNC(common,hasItem) || +[_unit, "kat_Armband_Medic_Goggles"] call ACEFUNC(common,hasItem) || +[_unit, "kat_Armband_Doctor_Goggles"] call ACEFUNC(common,hasItem) || +[_unit, "kat_Armband_Kat_Goggles"] call ACEFUNC(common,hasItem) || +[_unit, "kat_Armband_Red_Cross_NVG"] call ACEFUNC(common,hasItem) || +[_unit, "kat_Armband_Medic_NVG"] call ACEFUNC(common,hasItem) || +[_unit, "kat_Armband_Doctor_NVG"] call ACEFUNC(common,hasItem) || +[_unit, "kat_Armband_Kat_NVG"] call ACEFUNC(common,hasItem) || !(_unit getVariable [QGVAR(isRightArmFree), false]) || !(_unit getVariable [QGVAR(isLeftLegFree), false]) || !(_unit getVariable [QGVAR(isRightLegFree), false]) || diff --git a/addons/misc/functions/fnc_slingArmband.sqf b/addons/misc/functions/fnc_slingArmband.sqf index ed7965a47..beb3aa8e2 100644 --- a/addons/misc/functions/fnc_slingArmband.sqf +++ b/addons/misc/functions/fnc_slingArmband.sqf @@ -12,228 +12,80 @@ * None * * Example: - * [player, "kat_armband_red_cross", 0] call kat_misc_fnc_slingArmband; + * [player, "kat_Armband_Red_Cross_Goggles", 0] call kat_misc_fnc_slingArmband; * * Public: No */ params ["_unit", "_armbandItem", "_limbNumber"]; -private _str = missionNamespace getVariable [QGVAR(armbandSlingLeftArm), ""]; -private _array = [_str, ","" ", true] call FUNC(stringToArray); -_unit setVariable [QGVAR(armbandSlingLeftArmPos), _array, true]; +private _limbXYZ = []; +private _limbYPR = []; +private _limbBone = ""; -private _str = missionNamespace getVariable [QGVAR(armbandSlingRightArm), ""]; -private _array = [_str, ","" ", true] call FUNC(stringToArray); -_unit setVariable [QGVAR(armbandSlingRightArmPos), _array, true]; +switch (_limbNumber) do { + case 0: { + _limbXYZ = missionNamespace getVariable [QGVAR(armbandSlingLeftArm), []]; + _limbYPR = missionNamespace getVariable [QGVAR(armbandSlingLeftArmRotation), []]; + _limbBone = "leftforearm"; + }; -private _str = missionNamespace getVariable [QGVAR(armbandSlingLeftLeg), ""]; -private _array = [_str, ","" ", true] call FUNC(stringToArray); -_unit setVariable [QGVAR(armbandSlingLeftLegPos), _array, true]; + case 1: { + _limbXYZ = missionNamespace getVariable [QGVAR(armbandSlingRightArm), []]; + _limbYPR = missionNamespace getVariable [QGVAR(armbandSlingRightArmRotation), []]; + _limbBone = "rightforearm"; + }; -private _str = missionNamespace getVariable [QGVAR(armbandSlingRightLeg), ""]; -private _array = [_str, ","" ", true] call FUNC(stringToArray); -_unit setVariable [QGVAR(armbandSlingRightLegPos), _array, true]; + case 2: { + _limbXYZ = missionNamespace getVariable [QGVAR(armbandSlingLeftLeg), []]; + _limbYPR = missionNamespace getVariable [QGVAR(armbandSlingLeftLegRotation), []]; + _limbBone = "LeftUpLeg"; + }; -private _str = missionNamespace getVariable [QGVAR(armbandSlingLeftArmRotation), ""]; -private _array = [_str, ","" ", true] call FUNC(stringToArray); -_unit setVariable [QGVAR(armbandSlingLeftArmRot), _array, true]; + case 3: { + _limbXYZ = missionNamespace getVariable [QGVAR(armbandSlingRightLeg), []]; + _limbYPR = missionNamespace getVariable [QGVAR(armbandSlingRightLegRotation), []]; + _limbBone = "RightUpLeg"; + }; +}; -private _str = missionNamespace getVariable [QGVAR(armbandSlingRightArmRotation), ""]; -private _array = [_str, ","" ", true] call FUNC(stringToArray); -_unit setVariable [QGVAR(armbandSlingRightArmRot), _array, true]; +private _isNVG = _armbandItem find "V"; +private _armbandVersion = _armbandItem; +_unit removeItem _armbandItem; -private _str = missionNamespace getVariable [QGVAR(armbandSlingLeftLegRotation), ""]; -private _array = [_str, ","" ", true] call FUNC(stringToArray); -_unit setVariable [QGVAR(armbandSlingLeftLegRot), _array, true]; +if (_isNVG == -1) then { + _armbandItem = _armbandItem trim ["Goggles", 2]; +} else { + _armbandItem = _armbandItem trim ["NVG", 2]; +}; +_armbandItem = _armbandItem + "Object"; -private _str = missionNamespace getVariable [QGVAR(armbandSlingRightLegRotation), ""]; -private _array = [_str, ","" ", true] call FUNC(stringToArray); -_unit setVariable [QGVAR(armbandSlingRightLegRot), _array, true]; +private _armbandObject = _armbandItem createVehicle position _unit; +_armbandObject attachTo [_unit, _limbXYZ, _limbBone, true]; +[_armbandObject, _limbYPR] call BIS_fnc_setObjectRotation; -switch (_limbNumber) do -{ - // Attach to left arm +switch (_limbNumber) do { case 0: { - switch (_armbandItem) do - { - case "kat_armband_red_cross": { - _armbandLA = "Kat_armbandRC" createVehicle position _unit; - _armbandLA attachTo [_unit, _unit getVariable [QGVAR(armbandSlingLeftArmPos), [0, 0, 0]], "leftforearm", true]; - [_armbandLA, _unit getVariable [QGVAR(armbandSlingLeftArmRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isLeftArmFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedLA), _armbandLA, true]; - }; - - case "kat_armband_medic": { - _armbandLA = "Kat_armbandRCM" createVehicle position _unit; - _armbandLA attachTo [_unit, _unit getVariable [QGVAR(armbandSlingLeftArmPos), [0, 0, 0]], "leftforearm", true]; - [_armbandLA, _unit getVariable [QGVAR(armbandSlingLeftArmRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isLeftArmFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedLA), _armbandLA, true]; - }; - - case "kat_armband_doctor": { - _armbandLA = "Kat_armbandRCD" createVehicle position _unit; - _armbandLA attachTo [_unit, _unit getVariable [QGVAR(armbandSlingLeftArmPos), [0, 0, 0]], "leftforearm", true]; - [_armbandLA, _unit getVariable [QGVAR(armbandSlingLeftArmRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isLeftArmFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedLA), _armbandLA, true]; - }; - - case "kat_armband_kat": { - _armbandLA = "Kat_armbandKAT" createVehicle position _unit; - _armbandLA attachTo [_unit, _unit getVariable [QGVAR(armbandSlingLeftArmPos), [0, 0, 0]], "leftforearm", true]; - [_armbandLA, _unit getVariable [QGVAR(armbandSlingLeftArmRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isLeftArmFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedLA), _armbandLA, true]; - }; - }; + _unit setVariable [QGVAR(whichArmabndisSlingedLA), _armbandObject, true]; + _unit setVariable [QGVAR(armbandVersionLA), _armbandVersion, true]; + _unit setVariable [QGVAR(isLeftArmFree), false, true]; }; - // Attach to right arm case 1: { - switch (_armbandItem) do - { - case "kat_armband_red_cross": { - _armbandRA = "Kat_armbandRC" createVehicle position _unit; - _armbandRA attachTo [_unit, _unit getVariable [QGVAR(armbandSlingRightArmPos), [0, 0, 0]], "rightforearm", true]; - [_armbandRA, _unit getVariable [QGVAR(armbandSlingRightArmRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isRightArmFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedRA), _armbandRA, true]; - }; - - case "kat_armband_medic": { - _armbandRA = "Kat_armbandRCM" createVehicle position _unit; - _armbandRA attachTo [_unit, _unit getVariable [QGVAR(armbandSlingRightArmPos), [0, 0, 0]], "rightforearm", true]; - [_armbandRA, _unit getVariable [QGVAR(armbandSlingRightArmRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isRightArmFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedRA), _armbandRA, true]; - }; - - case "kat_armband_doctor": { - _armbandRA = "Kat_armbandRCD" createVehicle position _unit; - _armbandRA attachTo [_unit, _unit getVariable [QGVAR(armbandSlingRightArmPos), [0, 0, 0]], "rightforearm", true]; - [_armbandRA, _unit getVariable [QGVAR(armbandSlingRightArmRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isRightArmFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedRA), _armbandRA, true]; - }; - - case "kat_armband_kat": { - _armbandRA = "Kat_armbandKAT" createVehicle position _unit; - _armbandRA attachTo [_unit, _unit getVariable [QGVAR(armbandSlingRightArmPos), [0, 0, 0]], "rightforearm", true]; - [_armbandRA, _unit getVariable [QGVAR(armbandSlingRightArmRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isRightArmFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedRA), _armbandRA, true]; - }; - }; + _unit setVariable [QGVAR(whichArmabndisSlingedRA), _armbandObject, true]; + _unit setVariable [QGVAR(armbandVersionRA), _armbandVersion, true]; + _unit setVariable [QGVAR(isRightArmFree), false, true]; }; - // Attach to left leg case 2: { - switch (_armbandItem) do - { - case "kat_armband_red_cross": { - _armbandLL = "Kat_armbandRC" createVehicle position _unit; - _armbandLL attachTo [_unit, _unit getVariable [QGVAR(armbandSlingLeftLegPos), [0, 0, 0]], "LeftUpLeg", true]; - [_armbandLL, _unit getVariable [QGVAR(armbandSlingLeftLegRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isLeftLegFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedLL), _armbandLL, true]; - }; - - case "kat_armband_medic": { - _armbandLL = "Kat_armbandRCM" createVehicle position _unit; - _armbandLL attachTo [_unit, _unit getVariable [QGVAR(armbandSlingLeftLegPos), [0, 0, 0]], "LeftUpLeg", true]; - [_armbandLL, _unit getVariable [QGVAR(armbandSlingLeftLegRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isLeftLegFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedLL), _armbandLL, true]; - }; - - case "kat_armband_doctor": { - _armbandLL = "Kat_armbandRCD" createVehicle position _unit; - _armbandLL attachTo [_unit, _unit getVariable [QGVAR(armbandSlingLeftLegPos), [0, 0, 0]], "LeftUpLeg", true]; - [_armbandLL, _unit getVariable [QGVAR(armbandSlingLeftLegRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isLeftLegFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedLL), _armbandLL, true]; - }; - - case "kat_armband_kat": { - _armbandLL = "Kat_armbandKAT" createVehicle position _unit; - _armbandLL attachTo [_unit, _unit getVariable [QGVAR(armbandSlingLeftLegPos), [0, 0, 0]], "LeftUpLeg", true]; - [_armbandLL, _unit getVariable [QGVAR(armbandSlingLeftLegRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isLeftLegFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedLL), _armbandLL, true]; - }; - }; + _unit setVariable [QGVAR(whichArmabndisSlingedLL), _armbandObject, true]; + _unit setVariable [QGVAR(armbandVersionLL), _armbandVersion, true]; + _unit setVariable [QGVAR(isLeftLegFree), false, true]; }; - // Attach to right leg case 3: { - switch (_armbandItem) do - { - case "kat_armband_red_cross": { - _armbandRL = "Kat_armbandRC" createVehicle position _unit; - _armbandRL attachTo [_unit, _unit getVariable [QGVAR(armbandSlingRightLegPos), [0, 0, 0]], "RightUpLeg", true]; - [_armbandRL, _unit getVariable [QGVAR(armbandSlingRightLegRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isRightLegFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedRL), _armbandRL, true]; - }; - - case "kat_armband_medic": { - _armbandRL = "Kat_armbandRCM" createVehicle position _unit; - _armbandRL attachTo [_unit, _unit getVariable [QGVAR(armbandSlingRightLegPos), [0, 0, 0]], "RightUpLeg", true]; - [_armbandRL, _unit getVariable [QGVAR(armbandSlingRightLegRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isRightLegFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedRL), _armbandRL, true]; - }; - - case "kat_armband_doctor": { - _armbandRL = "Kat_armbandRCD" createVehicle position _unit; - _armbandRL attachTo [_unit, _unit getVariable [QGVAR(armbandSlingRightLegPos), [0, 0, 0]], "RightUpLeg", true]; - [_armbandRL, _unit getVariable [QGVAR(armbandSlingRightLegRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isRightLegFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedRL), _armbandRL, true]; - }; - - case "kat_armband_kat": { - _armbandRL = "Kat_armbandKAT" createVehicle position _unit; - _armbandRL attachTo [_unit, _unit getVariable [QGVAR(armbandSlingRightLegPos), [0, 0, 0]], "RightUpLeg", true]; - [_armbandRL, _unit getVariable [QGVAR(armbandSlingRightLegRot), [0, 0, 0]]] call BIS_fnc_setObjectRotation; - - _unit removeItem _armbandItem; - _unit setVariable [QGVAR(isRightLegFree), false, true]; - _unit setVariable [QGVAR(whichArmabndisSlingedRL), _armbandRL, true]; - }; - }; + _unit setVariable [QGVAR(whichArmabndisSlingedRL), _armbandObject, true]; + _unit setVariable [QGVAR(armbandVersionRL), _armbandVersion, true]; + _unit setVariable [QGVAR(isRightLegFree), false, true]; }; }; diff --git a/addons/misc/functions/fnc_unSlingArmband.sqf b/addons/misc/functions/fnc_unSlingArmband.sqf index 04c3192ed..f451f6eae 100644 --- a/addons/misc/functions/fnc_unSlingArmband.sqf +++ b/addons/misc/functions/fnc_unSlingArmband.sqf @@ -18,129 +18,34 @@ params ["_unit", "_limbNumber"]; -switch (_limbNumber) do -{ - case 0: { - private _objectLA = _unit getVariable [QGVAR(whichArmabndisSlingedLA), ObjNull]; - - switch (typeOf _objectLA) do - { - case "Kat_armbandRC": { - [_unit, "kat_armband_red_cross"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isLeftArmFree), true, true]; - deleteVehicle _objectLA; - }; - - case "Kat_armbandRCM": { - [_unit, "kat_armband_medic"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isLeftArmFree), true, true]; - deleteVehicle _objectLA; - }; +private _armbandObject = ObjNull; +private _originalArmband = ""; - case "Kat_armbandRCD": { - [_unit, "kat_armband_doctor"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isLeftArmFree), true, true]; - deleteVehicle _objectLA; - }; - - case "Kat_armbandKAT": { - [_unit, "kat_armband_kat"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isLeftArmFree), true, true]; - deleteVehicle _objectLA; - }; - }; +switch (_limbNumber) do { + case 0: { + _armbandObject = _unit getVariable [QGVAR(whichArmabndisSlingedLA), ObjNull]; + _originalArmband = _unit getVariable [QGVAR(armbandVersionLA), _armbandVersion]; + _unit setVariable [QGVAR(isLeftArmFree), true, true]; }; case 1: { - private _objectRA = _unit getVariable [QGVAR(whichArmabndisSlingedRA), ObjNull]; - - switch (typeOf _objectRA) do - { - case "Kat_armbandRC": { - [_unit, "kat_armband_red_cross"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isRightArmFree), true, true]; - deleteVehicle _objectRA; - }; - - case "Kat_armbandRCM": { - [_unit, "kat_armband_medic"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isRightArmFree), true, true]; - deleteVehicle _objectRA; - }; - - case "Kat_armbandRCD": { - [_unit, "kat_armband_doctor"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isRightArmFree), true, true]; - deleteVehicle _objectRA; - }; - - case "Kat_armbandKAT": { - [_unit, "kat_armband_kat"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isRightArmFree), true, true]; - deleteVehicle _objectRA; - }; - }; + _armbandObject = _unit getVariable [QGVAR(whichArmabndisSlingedRA), ObjNull]; + _originalArmband = _unit getVariable [QGVAR(armbandVersionRA), _armbandVersion]; + _unit setVariable [QGVAR(isRightArmFree), true, true]; }; case 2: { - private _objectLL = _unit getVariable [QGVAR(whichArmabndisSlingedLL), ObjNull]; - - switch (typeOf _objectLL) do - { - case "Kat_armbandRC": { - [_unit, "kat_armband_red_cross"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isLeftLegFree), true, true]; - deleteVehicle _objectLL; - }; - - case "Kat_armbandRCM": { - [_unit, "kat_armband_medic"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isLeftLegFree), true, true]; - deleteVehicle _objectLL; - }; - - case "Kat_armbandRCD": { - [_unit, "kat_armband_doctor"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isLeftLegFree), true, true]; - deleteVehicle _objectLL; - }; - - case "Kat_armbandKAT": { - [_unit, "kat_armband_kat"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isLeftLegFree), true, true]; - deleteVehicle _objectLL; - }; - }; + _armbandObject = _unit getVariable [QGVAR(whichArmabndisSlingedLL), ObjNull]; + _originalArmband = _unit getVariable [QGVAR(armbandVersionLL), _armbandVersion]; + _unit setVariable [QGVAR(isLeftLegFree), true, true]; }; case 3: { - private _objectRL = _unit getVariable [QGVAR(whichArmabndisSlingedRL), ObjNull]; - - switch (typeOf _objectRL) do - { - case "Kat_armbandRC": { - [_unit, "kat_armband_red_cross"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isRightLegFree), true, true]; - deleteVehicle _objectRL; - }; - - case "Kat_armbandRCM": { - [_unit, "kat_armband_medic"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isRightLegFree), true, true]; - deleteVehicle _objectRL; - }; - - case "Kat_armbandRCD": { - [_unit, "kat_armband_doctor"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isRightLegFree), true, true]; - deleteVehicle _objectRL; - }; - - case "Kat_armbandKAT": { - [_unit, "kat_armband_kat"] call ACEFUNC(common,addToInventory); - _unit setVariable [QGVAR(isRightLegFree), true, true]; - deleteVehicle _objectRL; - }; - }; + _armbandObject = _unit getVariable [QGVAR(whichArmabndisSlingedRL), ObjNull]; + _originalArmband = _unit getVariable [QGVAR(armbandVersionRL), _armbandVersion]; + _unit setVariable [QGVAR(isRightLegFree), true, true]; }; }; + +deleteVehicle _armbandObject; +[_unit, _originalArmband] call ACEFUNC(common,addToInventory);