Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical - Add Additional Hitpoints to the medical system #10482

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a38767b
initial commit
Cplhardcore Nov 5, 2024
4f03f3c
Update CfgVehicles.hpp
Cplhardcore Nov 5, 2024
2d0f1a9
Merge branch 'master' into Damage-Rework
Cplhardcore Nov 5, 2024
71daaa7
Missing curly bracket
Cplhardcore Nov 5, 2024
434f709
another one
Cplhardcore Nov 5, 2024
9243175
small fix
Cplhardcore Nov 5, 2024
c6effc9
Small fixes
Cplhardcore Nov 5, 2024
305654d
Update addons/medical_engine/functions/fnc_handleDamage.sqf
Cplhardcore Nov 5, 2024
822019f
Multiple fixes
Cplhardcore Nov 5, 2024
97c9fd4
Merge branch 'Damage-Rework' of https://github.com/Cplhardcore/ACE3 i…
Cplhardcore Nov 5, 2024
f4f3905
Fixing stringtables
Cplhardcore Nov 5, 2024
7c78535
Update addons/medical_gui/functions/fnc_updateBodyImage.sqf
Cplhardcore Nov 5, 2024
2aeda77
Update addons/medical_engine/functions/fnc_handleDamage.sqf
Cplhardcore Nov 5, 2024
0737077
Fixes
Cplhardcore Nov 5, 2024
799c794
Merge branch 'Damage-Rework' of https://github.com/Cplhardcore/ACE3 i…
Cplhardcore Nov 5, 2024
b6b1225
Adds switching to keypresses
Cplhardcore Nov 5, 2024
5b8e144
Adds a GET_BODYPART_DAMAGE macro, i think
Cplhardcore Nov 5, 2024
6fbea5a
small fix
Cplhardcore Nov 5, 2024
fd4c4cd
Fixing fractures
Cplhardcore Nov 5, 2024
9961493
GUI update
Cplhardcore Nov 6, 2024
1810f08
Hemtt suggestions
Cplhardcore Nov 8, 2024
7270e8d
Update fnc_updateBodyImage.sqf
Cplhardcore Nov 15, 2024
ac42769
Update script_component.hpp
Cplhardcore Nov 15, 2024
4b119bf
Update addons/medical_engine/functions/fnc_handleDamage.sqf
Cplhardcore Nov 16, 2024
263fbca
Merge branch 'Damage-Rework' of https://github.com/Cplhardcore/ACE3 i…
Cplhardcore Nov 16, 2024
ef08054
Update fnc_woundsHandlerBase.sqf
Cplhardcore Nov 16, 2024
3c906ce
GUI fixes
Cplhardcore Nov 17, 2024
09db653
Update fnc_woundsHandlerBase.sqf
Cplhardcore Nov 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 47 additions & 7 deletions addons/interaction/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,56 +172,96 @@ class CfgVehicles {

class ACE_Torso {
displayName = CSTRING(Torso);
selection = "spine1";
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_Chest {
displayName = CSTRING(Chest);
selection = "spine3";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_Head {
displayName = CSTRING(Head);
selection = "pilot";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_ArmLeft {
displayName = CSTRING(ArmLeft);
selection = "LWrist";
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_ArmUpperLeft {
displayName = CSTRING(ArmUpperLeft);
selection = "LeftForeArm";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_ArmRight {
displayName = CSTRING(ArmRight);
selection = "RWrist";
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_ArmUpperRight {
displayName = CSTRING(ArmUpperRight);
selection = "RightForeArm";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_LegLeft {
displayName = CSTRING(LegLeft);
selection = "LeftFoot";
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_LegUpperLeft {
displayName = CSTRING(LegUpperLeft);
selection = "LKnee";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_LegRight {
displayName = CSTRING(LegRight);
selection = "RightFoot";
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_LegUpperRight {
displayName = CSTRING(LegUpperRight);
selection = "RKnee";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_Weapon {
displayName = CSTRING(Weapon);
position = QUOTE(call DFUNC(getWeaponPos));
distance = 1.50;
distance = 5;
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
Expand Down
15 changes: 15 additions & 0 deletions addons/interaction/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
<Chinese>身體</Chinese>
<Turkish>Gövde</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_Chest">
<English>Chest</English>
</Key>
<Key ID="STR_ACE_Interaction_Head">
<English>Head</English>
<French>Tête</French>
Expand Down Expand Up @@ -85,6 +88,9 @@
<Chinese>左手</Chinese>
<Turkish>Sol Kol</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_ArmUpperLeft">
<English>Upper Left Arm</English>
</Key>
<Key ID="STR_ACE_Interaction_ArmRight">
<English>Right Arm</English>
<German>Rechter Arm</German>
Expand All @@ -102,6 +108,9 @@
<Chinese>右手</Chinese>
<Turkish>Sağ Kol</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_ArmUpperRight">
<English>Upper Right Arm</English>
</Key>
<Key ID="STR_ACE_Interaction_LegLeft">
<English>Left Leg</English>
<German>Linkes Bein</German>
Expand All @@ -119,6 +128,9 @@
<Chinese>左腳</Chinese>
<Turkish>Sol Bacak</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_LegUpperLeft">
<English>Upper Left Leg</English>
</Key>
<Key ID="STR_ACE_Interaction_LegRight">
<English>Right Leg</English>
<German>Rechtes Bein</German>
Expand All @@ -136,6 +148,9 @@
<Chinese>右腳</Chinese>
<Turkish>Sağ Bacak</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_LegUpperRight">
<English>Upper Right Leg</English>
</Key>
<Key ID="STR_ACE_Interaction_Weapon">
<English>Weapon</English>
<French>Arme</French>
Expand Down
2 changes: 1 addition & 1 deletion addons/medical/dev/test_hitpointConfigs.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private _testPass = true;
private _typeOf = configName _x;
if (_typeOf == "") then { continue };
private _hitpoints = (configProperties [_x >> "HitPoints", "isClass _x", true]) apply {toLowerANSI configName _x};
private _expectedHitPoints = ["hitleftarm","hitrightarm","hitleftleg","hitrightleg","hithead","hitbody"];
private _expectedHitPoints = ["hitaceleftarm","hitacerightarm","hitaceleftleg","hitacerightleg","hitaceupperleftarm","hitaceupperrightarm","hitaceupperleftleg","hitaceupperrightleg","hithead","hitbody","hitneck","hitabdomen"];
private _missingHitPoints = _expectedHitPoints select {!(_x in _hitpoints)};
if (_missingHitPoints isNotEqualTo []) then {
WARNING_3("%1 missing ace hitpoints: %2 - class hitpoints: %3",_typeOf,_missingHitPoints,_hitpoints);
Expand Down
2 changes: 1 addition & 1 deletion addons/medical/dev/watchVariable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0,0,0,0,0,0,0]];
private _limping = ["", "[<t color ='#FFCC22'> Limping </t>]"] 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];
Expand Down
6 changes: 3 additions & 3 deletions addons/medical/functions/fnc_addDamageToUnit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ if (!_overrideInvuln && {!((isDamageAllowed _unit) && {_unit getVariable [QEGVAR
};

// Extension is case sensitive and expects this format (different from ALL_BODY_PARTS)
_bodyPart = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] select _bodyPartIndex;
_bodyPart = ["_Head", "_Neck", "_Chest", "_Body", "_LeftArm", "_LeftUpperArm", "_RightArm", "_RightUpperArm", "_LeftLeg", "_LeftUpperLeg", "_RightLeg", "_RightUpperLeg"] select _bodyPartIndex;

if (!isNull _instigator) then {
_unit setVariable [QEGVAR(medical,lastDamageSource), _instigator];
_unit setVariable [QEGVAR(medical,lastInstigator), _instigator];
};

#ifdef DEBUG_TESTRESULTS
private _startDmg = +(_unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]);
private _startDmg = +(_unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0,0,0,0,0,0,0]];);
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 = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0,0,0,0,0,0,0]];
private _endPain = GET_PAIN(_unit);
private _typeOfDamageAdj = _typeOfDamage call EFUNC(medical_damage,getTypeOfDamage);
private _config = configFile >> "ACE_Medical_Injuries" >> "damageTypes" >> _typeOfDamageAdj;
Expand Down
2 changes: 1 addition & 1 deletion addons/medical/functions/fnc_deserializeState.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
[QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0,0,0,0,0,0,0]]
// Offset needs to be converted
// [VAR_MEDICATIONS, []]
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function needs handling of previous format of bodyPartDamage array.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For BWC? or is there something else I am oblivious to

Expand Down
2 changes: 1 addition & 1 deletion addons/medical/functions/fnc_serializeState.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
[QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0,0,0,0,0,0,0]]
// Time needs to be converted
// [VAR_MEDICATIONS, []]
];
Expand Down
4 changes: 2 additions & 2 deletions addons/medical_damage/functions/fnc_handleIncapacitation.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
params ["_unit"];

private _painLevel = GET_PAIN_PERCEIVED(_unit);
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0,0,0,0,0,0,0]];

_bodyPartDamage params ["_headDamage", "_bodyDamage"];
_bodyPartDamage params ["_headDamage", "_neckDamage", "_chestDamage","_bodyDamage"];

// Exclude non penetrating body damage
{
Expand Down
18 changes: 15 additions & 3 deletions addons/medical_damage/functions/fnc_woundsHandlerBase.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,26 @@
private _updateDamageEffects = false;
private _painLevel = 0;
private _criticalDamage = false;
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0,0,0,0,0,0,0]];
private _bodyPartVisParams = [_unit, false, false, false, false]; // params array for EFUNC(medical_engine,updateBodyPartVisuals);

// process wounds separately for each body part hit
{ // forEach _allDamages
_x params ["_damage", "_bodyPart"];
_bodyPart = toLowerANSI _bodyPart;

if (_bodyPart == "head") then {
private _isNeck = (random 1) < 0.1; // 15% chance for neck damage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems arbitrary. Can this not be handled via medical_engine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, as the hitbox for neck damage is unbelievably small, to the point its impossible to hit
Plus jaw/lower head damage still affects the neck area

_bodyPart = if (_isNeck) then {"neck"} else {"head"};

Check notice on line 47 in addons/medical_damage/functions/fnc_woundsHandlerBase.sqf

View workflow job for this annotation

GitHub Actions / windows

assignment to if can be replaced with select

use select

Check notice on line 47 in addons/medical_damage/functions/fnc_woundsHandlerBase.sqf

View workflow job for this annotation

GitHub Actions / build

assignment to if can be replaced with select

use select
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
};
if (_bodyPart in ["leftarm", "rightarm", "leftleg", "rightleg"]) then {
private _isUpper = (random 1) < 0.5;
switch (_bodyPart) do {
case "leftarm": { _bodyPart = if (_isUpper) then {"upperleftarm"} else {"leftarm"}; };

Check notice on line 52 in addons/medical_damage/functions/fnc_woundsHandlerBase.sqf

View workflow job for this annotation

GitHub Actions / windows

assignment to if can be replaced with select

use select

Check notice on line 52 in addons/medical_damage/functions/fnc_woundsHandlerBase.sqf

View workflow job for this annotation

GitHub Actions / build

assignment to if can be replaced with select

use select
case "rightarm": { _bodyPart = if (_isUpper) then {"upperrightarm"} else {"rightarm"}; };

Check notice on line 53 in addons/medical_damage/functions/fnc_woundsHandlerBase.sqf

View workflow job for this annotation

GitHub Actions / windows

assignment to if can be replaced with select

use select

Check notice on line 53 in addons/medical_damage/functions/fnc_woundsHandlerBase.sqf

View workflow job for this annotation

GitHub Actions / build

assignment to if can be replaced with select

use select
case "leftleg": { _bodyPart = if (_isUpper) then {"upperleftleg"} else {"leftleg"}; };

Check notice on line 54 in addons/medical_damage/functions/fnc_woundsHandlerBase.sqf

View workflow job for this annotation

GitHub Actions / windows

assignment to if can be replaced with select

use select

Check notice on line 54 in addons/medical_damage/functions/fnc_woundsHandlerBase.sqf

View workflow job for this annotation

GitHub Actions / build

assignment to if can be replaced with select

use select
case "rightleg": { _bodyPart = if (_isUpper) then {"upperrightleg"} else {"rightleg"}; };

Check notice on line 55 in addons/medical_damage/functions/fnc_woundsHandlerBase.sqf

View workflow job for this annotation

GitHub Actions / windows

assignment to if can be replaced with select

use select

Check notice on line 55 in addons/medical_damage/functions/fnc_woundsHandlerBase.sqf

View workflow job for this annotation

GitHub Actions / build

assignment to if can be replaced with select

use select
};
};
// silently ignore structural damage
if (_bodyPart == "#structural") then {continue};

Expand Down Expand Up @@ -90,7 +102,7 @@
private _woundDamage = _dmgPerWound * _dmgMultiplier * random [0.9, 1, 1.1];

_bodyPartDamage set [_bodyPartNToAdd, (_bodyPartDamage select _bodyPartNToAdd) + _woundDamage];
_bodyPartVisParams set [[1,2,3,3,4,4] select _bodyPartNToAdd, true]; // Mark the body part index needs updating
_bodyPartVisParams set [[1,1,1,2,2,2,3,3,3,4,4,4] select _bodyPartNToAdd, true]; // Mark the body part index needs updating

// Anything above this value is guaranteed worst wound possible
private _worstDamage = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TRACE_3("woundsHandlerBurning",_unit,_allDamages,_typeOfDamage);
[{
params ["_unit"];

private _bodyPart = selectRandom ["body", "leftleg", "rightleg"];
private _bodyPart = selectRandom ["Head", "Neck", "Chest", "Body", "LeftArm", "UpperLeftArm", "RightArm", "UpperRightArm", "LeftLeg", "UpperLeftLeg", "RightLeg", "UpperRightLeg"];
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
private _storedDamage = _unit getVariable [QGVAR(storedBurnDamage), 0];
[QEGVAR(medical,woundReceived), [_unit, [[_storedDamage, _bodyPart, _storedDamage]], _unit, "burn"]] call CBA_fnc_localEvent;
_unit setVariable [QGVAR(storedBurnDamage), 0, true];
Expand Down
2 changes: 1 addition & 1 deletion addons/medical_damage/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define COMPONENT_BEAUTIFIED Medical Damage
#include "\z\ace\addons\main\script_mod.hpp"

// #define DEBUG_MODE_FULL
#define DEBUG_MODE_FULL
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS

Expand Down
27 changes: 17 additions & 10 deletions addons/medical_engine/functions/fnc_handleDamage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ if (_structuralDamage) then {
} else {
_oldDamage = _unit getHitIndex _hitPointIndex;
};

// Damage can be disabled with old variable or via sqf command allowDamage
if !(isDamageAllowed _unit && {_unit getVariable [QEGVAR(medical,allowDamage), true]}) exitWith {_oldDamage};

Expand Down Expand Up @@ -84,7 +83,7 @@ if (
// todo: no way to detect if stationary and another vehicle hits you
) exitWith {
TRACE_5("Crash",_unit,_shooter,_instigator,_damage,_newDamage);
[QEGVAR(medical,woundReceived), [_unit, [[_newDamage, _hitPoint, _newDamage]], _unit, "vehiclecrash"]] call CBA_fnc_localEvent;
[QEGVAR(medical,woundReceived), [_unit, [[_newDamage, _hitpoint, _newDamage]], _unit, "vehiclecrash"]] call CBA_fnc_localEvent;

0
};
Expand All @@ -104,13 +103,13 @@ if (
_unit setVariable [QEGVAR(medical,lastDamageSource), _shooter];
_unit setVariable [QEGVAR(medical,lastInstigator), _instigator];

[QEGVAR(medical,woundReceived), [_unit, [[_newDamage, _hitPoint, _newDamage]], _shooter, "vehiclehit"]] call CBA_fnc_localEvent;
[QEGVAR(medical,woundReceived), [_unit, [[_newDamage, _hitpoint, _newDamage]], _shooter, "vehiclehit"]] call CBA_fnc_localEvent;

0
};

// Damages are stored for last iteration of the HandleDamage event (_context == 2)
_unit setVariable [format [QGVAR($%1), _hitPoint], [_realDamage, _newDamage]];
_unit setVariable [format [QGVAR($%1), _hitpoint], [_realDamage, _newDamage]];

// Ref https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
// Context 2 means this is the last iteration of HandleDamage, so figure out which hitpoint took the most real damage and send wound event
Expand All @@ -124,23 +123,29 @@ if (_context == 2) then {
// --- Head
private _damageHead = [
_unit getVariable [QGVAR($HitFace), [0,0]],
_unit getVariable [QGVAR($HitNeck), [0,0]],
_unit getVariable [QGVAR($HitHead), [0,0]]
];
_damageHead sort false;
_damageHead = _damageHead select 0;

// --- Neck
private _damageNeck = _unit getVariable [QGVAR($HitHitNeck), [0,0]];
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved

// --- Body
private _damageBody = [
_unit getVariable [QGVAR($HitPelvis), [0,0]],
_unit getVariable [QGVAR($HitAbdomen), [0,0]],
_unit getVariable [QGVAR($HitDiaphragm), [0,0]],
_unit getVariable [QGVAR($HitChest), [0,0]]
// HitBody removed as it's a placeholder hitpoint and the high armor value (1000) throws the calculations off
_unit getVariable [QGVAR($HitAbdomen), [0,0]]
];
_damageBody sort false;
_damageBody = _damageBody select 0;

private _damageChest = [
_unit getVariable [QGVAR($HitDiaphragm), [0,0]],
_unit getVariable [QGVAR($HitChest), [0,0]]
];
_damageChest sort false;
_damageChest = _damageChest select 0;

// --- Arms and Legs
private _damageLeftArm = _unit getVariable [QGVAR($HitLeftArm), [0,0]];
private _damageRightArm = _unit getVariable [QGVAR($HitRightArm), [0,0]];
Expand All @@ -152,6 +157,8 @@ if (_context == 2) then {
// _realDamage, priority, _newDamage, body part name
private _allDamages = [
[_damageHead select 0, PRIORITY_HEAD, _damageHead select 1, "Head"],
[_damageNeck select 0, PRIORITY_NECK, _damageNeck select 1, "Neck"],
[_damageChest select 0, PRIORITY_CHEST, _damageChest select 1, "Chest"],
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
[_damageBody select 0, PRIORITY_BODY, _damageBody select 1, "Body"],
[_damageLeftArm select 0, PRIORITY_LEFT_ARM, _damageLeftArm select 1, "LeftArm"],
[_damageRightArm select 0, PRIORITY_RIGHT_ARM, _damageRightArm select 1, "RightArm"],
Expand Down Expand Up @@ -213,4 +220,4 @@ if (_context == 2) then {
// Engine damage to these hitpoints controls blood visuals, limping, weapon sway
// Handled in fnc_damageBodyPart, persist here
// For all other hitpoints, we store our own damage values, so engine damage is unnecessary
[0, _oldDamage] select (_hitPoint in ["hithead", "hitbody", "hithands", "hitlegs"])
[0, _oldDamage] select (_hitPoint in ["hithead","hitneck", "hitbody","hitChest", "hithands","hitlegs"])
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 5 additions & 5 deletions addons/medical_engine/functions/fnc_updateBodyPartVisuals.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
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 = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0,0,0,0,0,0,0]];

if (_updateHead) then {
[_unit, "head", (_bodyPartDamage select 0) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
[_unit, "head", ((_bodyPartDamage select 0) max (_bodyPartDamage select 1)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break KAM FYI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh i am aware, ill have to do my own refactor of KAM with these changes if they do get merged

};
if (_updateBody) then {
[_unit, "body", (_bodyPartDamage select 1) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
[_unit, "body", ((_bodyPartDamage select 2) max (_bodyPartDamage select 3)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};
if (_updateArms) then {
[_unit, "arms", ((_bodyPartDamage select 2) max (_bodyPartDamage select 3)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
[_unit, "arms", (((_bodyPartDamage select 4) max (_bodyPartDamage select 5)) max ((_bodyPartDamage select 6) max (_bodyPartDamage select 7))) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};
if (_updateLegs) then {
[_unit, "legs", ((_bodyPartDamage select 4) max (_bodyPartDamage select 5)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
[_unit, "legs", (((_bodyPartDamage select 8) max (_bodyPartDamage select 9)) max ((_bodyPartDamage select 10) max (_bodyPartDamage select 11))) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};
Loading