diff --git a/addons/medical/dev/watchVariable.sqf b/addons/medical/dev/watchVariable.sqf
index 7684c1a17d9..7c27acbac8d 100644
--- a/addons/medical/dev/watchVariable.sqf
+++ b/addons/medical/dev/watchVariable.sqf
@@ -59,7 +59,7 @@ GVAR(dev_watchVariableRunning) = true;
_return pushBack format [" - [Pain: %1] [Suppress: %2]", _pain toFixed 3, _painSuppress toFixed 3];
// Damage:
- private _damage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
+ private _damage = GET_BODYPART_DAMAGE(_unit);
private _limping = ["", "[ Limping ]"] select (_unit getVariable [QEGVAR(medical,isLimping), false]);
_return pushBack format ["BodyPartDamage: [H: %1] [B: %2]", (_damage select 0) toFixed 2, (_damage select 1) toFixed 2];
_return pushBack format ["[LA:%1] [RA: %2] [LL:%3] [RL: %4]", (_damage select 2) toFixed 2, (_damage select 3) toFixed 2, (_damage select 4) toFixed 2, (_damage select 5) toFixed 2];
diff --git a/addons/medical/functions/fnc_addDamageToUnit.sqf b/addons/medical/functions/fnc_addDamageToUnit.sqf
index 2ffe8d77322..7d71888eb08 100644
--- a/addons/medical/functions/fnc_addDamageToUnit.sqf
+++ b/addons/medical/functions/fnc_addDamageToUnit.sqf
@@ -54,14 +54,14 @@ if (!isNull _instigator) then {
};
#ifdef DEBUG_TESTRESULTS
-private _startDmg = +(_unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]);
+private _startDmg = +GET_BODYPART_DAMAGE(_unit);
private _startPain = GET_PAIN(_unit);
#endif
[QEGVAR(medical,woundReceived), [_unit, [[_damageToAdd, _bodyPart, _damageToAdd]], _instigator, _typeOfDamage]] call CBA_fnc_localEvent;
#ifdef DEBUG_TESTRESULTS
-private _endDmg = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
+private _endDmg = GET_BODYPART_DAMAGE(_unit);
private _endPain = GET_PAIN(_unit);
private _typeOfDamageAdj = _typeOfDamage call EFUNC(medical_damage,getTypeOfDamage);
private _config = configFile >> "ACE_Medical_Injuries" >> "damageTypes" >> _typeOfDamageAdj;
diff --git a/addons/medical/functions/fnc_deserializeState.sqf b/addons/medical/functions/fnc_deserializeState.sqf
index 6fbb00985db..8416599bec5 100644
--- a/addons/medical/functions/fnc_deserializeState.sqf
+++ b/addons/medical/functions/fnc_deserializeState.sqf
@@ -97,7 +97,7 @@ private _state = [_json] call CBA_fnc_parseJSON;
[QEGVAR(medical,ivBags), nil],
[QEGVAR(medical,triageLevel), 0],
[QEGVAR(medical,triageCard), []],
- [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]
+ [VAR_BODYPART_DAMAGE, DEFAULT_BODYPART_DAMAGE_VALUES]
// Offset needs to be converted
// [VAR_MEDICATIONS, []]
];
diff --git a/addons/medical/functions/fnc_serializeState.sqf b/addons/medical/functions/fnc_serializeState.sqf
index 67783e85d94..b12cf781cd3 100644
--- a/addons/medical/functions/fnc_serializeState.sqf
+++ b/addons/medical/functions/fnc_serializeState.sqf
@@ -44,7 +44,7 @@ private _state = [] call CBA_fnc_createNamespace;
[QEGVAR(medical,ivBags), nil],
[QEGVAR(medical,triageLevel), 0],
[QEGVAR(medical,triageCard), []],
- [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]
+ [VAR_BODYPART_DAMAGE, DEFAULT_BODYPART_DAMAGE_VALUES]
// Time needs to be converted
// [VAR_MEDICATIONS, []]
];
diff --git a/addons/medical_damage/functions/fnc_handleIncapacitation.sqf b/addons/medical_damage/functions/fnc_handleIncapacitation.sqf
index 391d69c08bf..be9e80db8a0 100644
--- a/addons/medical_damage/functions/fnc_handleIncapacitation.sqf
+++ b/addons/medical_damage/functions/fnc_handleIncapacitation.sqf
@@ -18,7 +18,7 @@
params ["_unit"];
private _painLevel = GET_PAIN_PERCEIVED(_unit);
-private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
+private _bodyPartDamage = GET_BODYPART_DAMAGE(_unit);
_bodyPartDamage params ["_headDamage", "_bodyDamage"];
diff --git a/addons/medical_damage/functions/fnc_woundsHandlerBase.sqf b/addons/medical_damage/functions/fnc_woundsHandlerBase.sqf
index 270e77b2513..402018353aa 100644
--- a/addons/medical_damage/functions/fnc_woundsHandlerBase.sqf
+++ b/addons/medical_damage/functions/fnc_woundsHandlerBase.sqf
@@ -35,7 +35,7 @@ private _createdWounds = false;
private _updateDamageEffects = false;
private _painLevel = 0;
private _criticalDamage = false;
-private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
+private _bodyPartDamage = GET_BODYPART_DAMAGE(_unit);
private _bodyPartVisParams = [_unit, false, false, false, false]; // params array for EFUNC(medical_engine,updateBodyPartVisuals);
// process wounds separately for each body part hit
@@ -197,7 +197,7 @@ if (_updateDamageEffects) then {
if (_createdWounds) then {
_unit setVariable [VAR_OPEN_WOUNDS, _openWounds, true];
- _unit setVariable [QEGVAR(medical,bodyPartDamage), _bodyPartDamage, true];
+ _unit setVariable [VAR_BODYPART_DAMAGE, _bodyPartDamage, true];
_bodyPartVisParams call EFUNC(medical_engine,updateBodyPartVisuals);
diff --git a/addons/medical_engine/functions/fnc_updateBodyPartVisuals.sqf b/addons/medical_engine/functions/fnc_updateBodyPartVisuals.sqf
index a4403ffa7d5..219b46d5894 100644
--- a/addons/medical_engine/functions/fnc_updateBodyPartVisuals.sqf
+++ b/addons/medical_engine/functions/fnc_updateBodyPartVisuals.sqf
@@ -22,7 +22,7 @@
params ["_unit", "_updateHead", "_updateBody", "_updateArms", "_updateLegs"];
TRACE_5("updateBodyPartVisuals",_unit,_updateHead,_updateBody,_updateArms,_updateLegs);
-private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
+private _bodyPartDamage = GET_BODYPART_DAMAGE(_unit);
if (_updateHead) then {
[_unit, "head", (_bodyPartDamage select 0) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
diff --git a/addons/medical_engine/script_macros_medical.hpp b/addons/medical_engine/script_macros_medical.hpp
index 167765c5767..20a9a689209 100644
--- a/addons/medical_engine/script_macros_medical.hpp
+++ b/addons/medical_engine/script_macros_medical.hpp
@@ -134,6 +134,8 @@
#define DEFAULT_FRACTURE_VALUES [0,0,0,0,0,0]
+#define DEFAULT_BODYPART_DAMAGE_VALUES [0,0,0,0,0,0]
+
// Triage colors, for consistency across UIs and functions
#define TRIAGE_COLOR_NONE 0, 0, 0, 0.9
#define TRIAGE_COLOR_MINIMAL 0, 0.5, 0, 0.9
@@ -168,6 +170,7 @@
#define VAR_OPEN_WOUNDS QEGVAR(medical,openWounds)
#define VAR_BANDAGED_WOUNDS QEGVAR(medical,bandagedWounds)
#define VAR_STITCHED_WOUNDS QEGVAR(medical,stitchedWounds)
+#define VAR_BODYPART_DAMAGE QEGVAR(medical,bodyPartDamage)
// These variables track gradual adjustments (from medication, etc.)
#define VAR_MEDICATIONS QEGVAR(medical,medications)
// These variables track the current state of status values above
@@ -197,6 +200,7 @@
#define GET_BANDAGED_WOUNDS(unit) (unit getVariable [VAR_BANDAGED_WOUNDS, createHashMap])
#define GET_STITCHED_WOUNDS(unit) (unit getVariable [VAR_STITCHED_WOUNDS, createHashMap])
#define GET_DAMAGE_THRESHOLD(unit) (unit getVariable [QEGVAR(medical,damageThreshold), [EGVAR(medical,AIDamageThreshold),EGVAR(medical,playerDamageThreshold)] select (isPlayer unit)])
+#define GET_BODYPART_DAMAGE(unit) (unit getVariable [VAR_BODYPART_DAMAGE, DEFAULT_BODYPART_DAMAGE_VALUES])
// The following function calls are defined here just for consistency
#define GET_BLOOD_LOSS(unit) ([unit] call EFUNC(medical_status,getBloodLoss))
diff --git a/addons/medical_gui/functions/fnc_updateBodyImage.sqf b/addons/medical_gui/functions/fnc_updateBodyImage.sqf
index 25204e4b6ac..e197ef96a4e 100644
--- a/addons/medical_gui/functions/fnc_updateBodyImage.sqf
+++ b/addons/medical_gui/functions/fnc_updateBodyImage.sqf
@@ -22,7 +22,7 @@ params ["_ctrlGroup", "_target", "_selectionN"];
// Get tourniquets, damage, and blood loss for target
private _tourniquets = GET_TOURNIQUETS(_target);
private _fractures = GET_FRACTURES(_target);
-private _bodyPartDamage = _target getVariable [QEGVAR(medical,bodyPartDamage), [0, 0, 0, 0, 0, 0]];
+private _bodyPartDamage = GET_BODYPART_DAMAGE(_target);
private _damageThreshold = GET_DAMAGE_THRESHOLD(_target);
private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0];
diff --git a/addons/medical_gui/functions/fnc_updateInjuryList.sqf b/addons/medical_gui/functions/fnc_updateInjuryList.sqf
index c9c9694a445..8cd5ef2fb4a 100644
--- a/addons/medical_gui/functions/fnc_updateInjuryList.sqf
+++ b/addons/medical_gui/functions/fnc_updateInjuryList.sqf
@@ -163,7 +163,7 @@ _entries pushBack [localize _bodyPartName, [1, 1, 1, 1]];
// Damage taken tooltip
if (GVAR(showDamageEntry)) then {
- private _bodyPartDamage = (_target getVariable [QEGVAR(medical,bodyPartDamage), [0, 0, 0, 0, 0, 0]]) select _selectionN;
+ private _bodyPartDamage = GET_BODYPART_DAMAGE(_target) select _selectionN;
if (_bodyPartDamage > 0) then {
private _damageThreshold = GET_DAMAGE_THRESHOLD(_target);
switch (true) do {
diff --git a/addons/medical_status/functions/fnc_initUnit.sqf b/addons/medical_status/functions/fnc_initUnit.sqf
index 278163d90b9..f1e5c1a4df3 100644
--- a/addons/medical_status/functions/fnc_initUnit.sqf
+++ b/addons/medical_status/functions/fnc_initUnit.sqf
@@ -70,7 +70,7 @@ if (_isRespawn) then {
_unit setVariable [QEGVAR(medical,triageCard), [], true];
// Damage storage
- _unit setVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0], true];
+ _unit setVariable [VAR_BODYPART_DAMAGE, DEFAULT_BODYPART_DAMAGE_VALUES, true];
// Medication
_unit setVariable [VAR_MEDICATIONS, [], true];
diff --git a/addons/medical_treatment/XEH_PREP.hpp b/addons/medical_treatment/XEH_PREP.hpp
index d7165b59705..b0ebf325e76 100644
--- a/addons/medical_treatment/XEH_PREP.hpp
+++ b/addons/medical_treatment/XEH_PREP.hpp
@@ -1,6 +1,7 @@
PREP(addLoadPatientActions);
PREP(addToLog);
PREP(addToTriageCard);
+PREP(addTrauma);
PREP(bandage);
PREP(bandageLocal);
PREP(bodyCleanupLoop);
@@ -58,6 +59,7 @@ PREP(scanMedicalItems);
PREP(setTriageStatus);
PREP(splint);
PREP(splintLocal);
+PREP(stitchWound);
PREP(surgicalKitProgress);
PREP(surgicalKitStart);
PREP(tourniquet);
diff --git a/addons/medical_treatment/functions/fnc_addTrauma.sqf b/addons/medical_treatment/functions/fnc_addTrauma.sqf
new file mode 100644
index 00000000000..dab6f1d929c
--- /dev/null
+++ b/addons/medical_treatment/functions/fnc_addTrauma.sqf
@@ -0,0 +1,43 @@
+#include "..\script_component.hpp"
+/*
+ * Author: LinkIsGrim
+ * Add trauma to a body part.
+ *
+ * Arguments:
+ * 0: Patient