Medical - Add arsenal category (#9220)

* add medical category to arsenal

* function header

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* move to preinit, protect list

* improve macro

* documentation

* add config property

* add CfgMagazines

* Revert "add CfgMagazines"

Arsenal doesn't support magazines in custom categories

---------

Co-authored-by: GhostIsSpooky <69561145+Salluci@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
Grim 2023-07-07 07:14:44 +03:00 committed by GitHub
parent 30a0e55843
commit 0e26755b88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 83 additions and 0 deletions

View File

@ -8,12 +8,14 @@ class CfgWeapons {
class FirstAidKit: ItemCore {
type = 0;
ACE_isMedicalItem = 1;
class ItemInfo: InventoryFirstAidKitItem_Base_F {
mass = 4;
};
};
class Medikit: ItemCore {
type = 0;
ACE_isMedicalItem = 1;
class ItemInfo: MedikitItem {
mass = 60;
};
@ -27,6 +29,7 @@ class CfgWeapons {
displayName = CSTRING(Bandage_Basic_Display);
descriptionShort = CSTRING(Bandage_Basic_Desc_Short);
descriptionUse = CSTRING(Bandage_Basic_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
@ -39,6 +42,7 @@ class CfgWeapons {
model = QPATHTOF(data\packingbandage.p3d);
descriptionShort = CSTRING(Packing_Bandage_Desc_Short);
descriptionUse = CSTRING(Packing_Bandage_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
@ -51,6 +55,7 @@ class CfgWeapons {
model = "\A3\Structures_F_EPA\Items\Medical\Bandage_F.p3d";
descriptionShort = CSTRING(Bandage_Elastic_Desc_Short);
descriptionUse = CSTRING(Bandage_Elastic_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
@ -63,6 +68,7 @@ class CfgWeapons {
model = QPATHTOF(data\tourniquet.p3d);
descriptionShort = CSTRING(Tourniquet_Desc_Short);
descriptionUse = CSTRING(Tourniquet_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
@ -74,6 +80,7 @@ class CfgWeapons {
picture = QPATHTOF(ui\splint_ca.paa);
model = QPATHTOF(data\splint.p3d);
descriptionShort = CSTRING(splint_Desc_Short);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 2;
};
@ -86,6 +93,7 @@ class CfgWeapons {
model = QPATHTOF(data\morphine.p3d);
descriptionShort = CSTRING(Morphine_Desc_Short);
descriptionUse = CSTRING(Morphine_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
@ -98,6 +106,7 @@ class CfgWeapons {
model = QPATHTOF(data\adenosine.p3d);
descriptionShort = CSTRING(adenosine_Desc_Short);
descriptionUse = CSTRING(adenosine_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
@ -110,6 +119,7 @@ class CfgWeapons {
model = QPATHTOF(data\atropine.p3d);
descriptionShort = CSTRING(Atropine_Desc_Short);
descriptionUse = CSTRING(Atropine_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
@ -122,6 +132,7 @@ class CfgWeapons {
model = QPATHTOF(data\epinephrine.p3d);
descriptionShort = CSTRING(Epinephrine_Desc_Short);
descriptionUse = CSTRING(Epinephrine_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
@ -137,6 +148,7 @@ class CfgWeapons {
picture = QPATHTOF(ui\plasmaIV_ca.paa);
descriptionShort = CSTRING(Plasma_IV_Desc_Short);
descriptionUse = CSTRING(Plasma_IV_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 10;
};
@ -167,6 +179,7 @@ class CfgWeapons {
hiddenSelectionsTextures[] = {QPATHTOF(data\IVBag_blood_1000ml_ca.paa)};
descriptionShort = CSTRING(Blood_IV_Desc_Short);
descriptionUse = CSTRING(Blood_IV_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 10;
};
@ -197,6 +210,7 @@ class CfgWeapons {
picture = QPATHTOF(ui\salineIV_ca.paa);
descriptionShort = CSTRING(Saline_IV_Desc_Short);
descriptionUse = CSTRING(Saline_IV_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 10;
};
@ -225,6 +239,7 @@ class CfgWeapons {
picture = QPATHTOF(ui\quickclot_ca.paa);
descriptionShort = CSTRING(QuikClot_Desc_Short);
descriptionUse = CSTRING(QuikClot_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
@ -236,6 +251,7 @@ class CfgWeapons {
picture = QPATHTOF(ui\personal_aid_kit_ca.paa);
descriptionShort = CSTRING(Aid_Kit_Desc_Short);
descriptionUse = CSTRING(Aid_Kit_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 10;
};
@ -248,6 +264,7 @@ class CfgWeapons {
picture = QPATHTOF(ui\surgicalKit_ca.paa);
descriptionShort = CSTRING(SurgicalKit_Desc_Short);
descriptionUse = CSTRING(SurgicalKit_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 15;
};
@ -260,6 +277,7 @@ class CfgWeapons {
picture = QPATHTOF(ui\suture_ca.paa);
descriptionShort = CSTRING(Suture_Desc_Short);
descriptionUse = CSTRING(Suture_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
@ -272,6 +290,7 @@ class CfgWeapons {
picture = QPATHTOF(ui\bodybag_ca.paa);
descriptionShort = CSTRING(Bodybag_Desc_Short);
descriptionUse = CSTRING(Bodybag_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 7;
};

View File

@ -48,6 +48,7 @@ PREP(medicationLocal);
PREP(onMedicationUsage);
PREP(placeInBodyBag);
PREP(removeBody);
PREP(scanMedicalItems);
PREP(setTriageStatus);
PREP(splint);
PREP(splintLocal);

View File

@ -8,6 +8,8 @@ PREP_RECOMPILE_END;
#include "initSettings.sqf"
#define ARSENAL_CATEGORY_ICON (["\A3\ui_f\data\igui\cfg\actions\heal_ca.paa", QPATHTOEF(medical_gui,data\categories\bandage_fracture.paa)] select (["ace_medical_gui"] call EFUNC(common,isModLoaded)))
// config to determine animation acceleration coefficient
// adjusting these is trail and error
// if the animation is cut of ingame, increase these values
@ -44,4 +46,9 @@ GVAR(facilityClasses) = [];
} forEach getArray _x;
} forEach configProperties [configFile >> QEGVAR(medical,facilities), "isArray _x"];
// Custom Arsenal tab
if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then {
[MEDICAL_TREATMENT_ITEMS, LELSTRING(medical,Category), ARSENAL_CATEGORY_ICON] call EFUNC(arsenal,addRightPanelButton);
};
ADDON = true;

View File

@ -1,3 +1,5 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"
call FUNC(scanMedicalItems)

View File

@ -0,0 +1,34 @@
#include "script_component.hpp"
/*
* Author: Salluci
* Caches all item classnames used in ACE_Medical_Treatment_Actions
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_medical_treatment_fnc_scanMedicalItems
*
* Public: No
*/
private _list = [];
private _cfgActions = configFile >> QGVAR(actions);
private _fnc_isMedicalItem = toString {
getNumber (_x >> "ACE_isMedicalItem") isEqualTo 1
};
// get items in ACE_Medical_Treament_Actions, fallback for items without API config property
{
_list append (getArray (_x >> "items"));
} forEach ("true" configClasses _cfgActions);
{
_list pushBack (configName _x);
} forEach (_fnc_isMedicalItem configClasses (configFile >> "CfgWeapons"));
uiNamespace setVariable [QGVAR(treatmentItems), compileFinal str (_list arrayIntersect _list)]

View File

@ -54,3 +54,5 @@
// Animations that would be played faster than this are instead skipped. (= Progress bar too quick for animation).
#define ANIMATION_SPEED_MAX_COEFFICIENT 2.5
#define MEDICAL_TREATMENT_ITEMS (call (uiNamespace getVariable [QGVAR(treatmentItems), {[]}]))

View File

@ -38,3 +38,21 @@ class CfgVehicles {
};
};
```
### 1.3 Treatment Items
Items in `CfgWeapons` with `ACE_isMedicalItem` property will be added to the ACE Medical category in the ACE Arsenal.
```cpp
class CfgWeapons {
class MyMedicalItem {
ACE_isMedicalItem = 1;
};
};
```
Required items in `ACE_Medical_Treatment_Actions` will also be added as a fallback.
```cpp
class ACE_Medical_Treatment_Actions {
class MyCustomTreatment {
items[] = {"MyMedicalItem"};
};
};
```