Medical GUI - Add setting to show Damage (#8444)

* use pain variable for severe pain and use threshold in damage color calculation

show % of damage threshold in medical menu

* use damage taken instead of damage left

* Add setting and switch to separate tooltip

* tooltip -> entry

* Change display names and tooltip

* switch to qualitative

* remove newlines

---------

Co-authored-by: Salluci <69561145+Salluci@users.noreply.github.com>
Co-authored-by: BrettMayson <brett@mayson.io>
This commit is contained in:
Grim 2023-07-01 01:37:08 +03:00 committed by GitHub
parent 22b93e2d03
commit ba4fcf615d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 2 deletions

View File

@ -22,6 +22,7 @@ params ["_ctrlGroup", "_target"];
private _tourniquets = GET_TOURNIQUETS(_target); private _tourniquets = GET_TOURNIQUETS(_target);
private _fractures = GET_FRACTURES(_target); private _fractures = GET_FRACTURES(_target);
private _bodyPartDamage = _target getVariable [QEGVAR(medical,bodyPartDamage), [0, 0, 0, 0, 0, 0]]; private _bodyPartDamage = _target getVariable [QEGVAR(medical,bodyPartDamage), [0, 0, 0, 0, 0, 0]];
private _damageThreshold = GET_DAMAGE_THRESHOLD(_target);
private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0]; private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0];
{ {
@ -70,6 +71,21 @@ private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0];
[_bloodLoss] call FUNC(bloodLossToRGBA); [_bloodLoss] call FUNC(bloodLossToRGBA);
} else { } else {
private _damage = _bodyPartDamage select _forEachIndex; private _damage = _bodyPartDamage select _forEachIndex;
switch (true) do { // torso damage threshold doesn't need scaling
case (_forEachIndex > 3): { // legs: index 4 & 5
_damageThreshold = LIMPING_DAMAGE_THRESHOLD * 4;
};
case (_forEachIndex > 1): { // arms: index 2 & 3
_damageThreshold = FRACTURE_DAMAGE_THRESHOLD * 4;
};
case (_forEachIndex == 0): { // head: index 0
_damageThreshold = _damageThreshold * 1.25;
};
default { // torso: index 1
_damageThreshold = _damageThreshold * 1.5
};
};
_damage = (_damage / _damageThreshold) min 1;
[_damage] call FUNC(damageToRGBA); [_damage] call FUNC(damageToRGBA);
}; };

View File

@ -33,6 +33,43 @@ private _bodyPartName = [
_entries pushBack [localize _bodyPartName, [1, 1, 1, 1]]; _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;
if (_bodyPartDamage > 0) then {
private _damageThreshold = GET_DAMAGE_THRESHOLD(_target);
switch (true) do {
case (_selectionN > 3): { // legs: index 4 & 5
_damageThreshold = LIMPING_DAMAGE_THRESHOLD * 4;
};
case (_selectionN > 1): { // arms: index 2 & 3
_damageThreshold = FRACTURE_DAMAGE_THRESHOLD * 4;
};
case (_selectionN == 0): { // head: index 0
_damageThreshold = _damageThreshold * 1.25;
};
default { // torso: index 1
_damageThreshold = _damageThreshold * 1.5;
};
};
_bodyPartDamage = (_bodyPartDamage / _damageThreshold) min 1;
switch (true) do {
case (_bodyPartDamage isEqualTo 1): {
_entries pushBack [localize LSTRING(traumaSustained4), [_bodyPartDamage] call FUNC(damageToRGBA)];
};
case (_bodyPartDamage >= 0.75): {
_entries pushBack [localize LSTRING(traumaSustained3), [_bodyPartDamage] call FUNC(damageToRGBA)];
};
case (_bodyPartDamage >= 0.5): {
_entries pushBack [localize LSTRING(traumaSustained2), [_bodyPartDamage] call FUNC(damageToRGBA)];
};
case (_bodyPartDamage >= 0.25): {
_entries pushBack [localize LSTRING(traumaSustained1), [_bodyPartDamage] call FUNC(damageToRGBA)];
};
};
};
};
// Indicate if unit is bleeding at all // Indicate if unit is bleeding at all
if (IS_BLEEDING(_target)) then { if (IS_BLEEDING(_target)) then {
_entries pushBack [localize LSTRING(Status_Bleeding), [1, 0, 0, 1]]; _entries pushBack [localize LSTRING(Status_Bleeding), [1, 0, 0, 1]];
@ -78,10 +115,10 @@ if (_target call EFUNC(common,isAwake)) then {
private _pain = GET_PAIN_PERCEIVED(_target); private _pain = GET_PAIN_PERCEIVED(_target);
if (_pain > 0) then { if (_pain > 0) then {
private _painText = switch (true) do { private _painText = switch (true) do {
case (_pain > 0.5): { case (_pain > PAIN_UNCONSCIOUS): {
ELSTRING(medical_treatment,Status_SeverePain); ELSTRING(medical_treatment,Status_SeverePain);
}; };
case (_pain > 0.1): { case (_pain > (PAIN_UNCONSCIOUS / 5)): {
ELSTRING(medical_treatment,Status_Pain); ELSTRING(medical_treatment,Status_Pain);
}; };
default { default {

View File

@ -109,6 +109,15 @@ private _categoryColors = [ELSTRING(medical,Category), format ["| %1 |", LELSTRI
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
} forEach _damageColors; } forEach _damageColors;
[
QGVAR(showDamageEntry),
"CHECKBOX",
[LSTRING(showDamageEntry_DisplayName), LSTRING(showDamageEntry_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory)],
false,
true
] call CBA_fnc_addSetting;
[ [
QGVAR(showBloodlossEntry), QGVAR(showBloodlossEntry),
"CHECKBOX", "CHECKBOX",

View File

@ -1250,5 +1250,29 @@
<Russian>Показывать тяжесть кровопотери в списке ранений.</Russian> <Russian>Показывать тяжесть кровопотери в списке ранений.</Russian>
<Spanish>Mostrar la pérdida de sangre cualitativa en la lista de heridas.</Spanish> <Spanish>Mostrar la pérdida de sangre cualitativa en la lista de heridas.</Spanish>
</Key> </Key>
<Key ID="STR_ACE_Medical_GUI_showDamageEntry_DisplayName">
<English>Show Trauma Sustained</English>
<Portuguese>Mostrar Traumatismo Sofrido</Portuguese>
</Key>
<Key ID="STR_ACE_Medical_GUI_showDamageEntry_Description">
<English>Show trauma sustained in the injury list.</English>
<Portuguese>Mostrar traumatismo sofrido na lista de feridas.</Portuguese>
</Key>
<Key ID="STR_ACE_Medical_GUI_traumaSustained1">
<English>Minor Trauma</English>
<Portuguese>Traumatismo Leve</Portuguese>
</Key>
<Key ID="STR_ACE_Medical_GUI_traumaSustained2">
<English>Major Trauma</English>
<Portuguese>Traumatismo Significante</Portuguese>
</Key>
<Key ID="STR_ACE_Medical_GUI_traumaSustained3">
<English>Severe Trauma</English>
<Portuguese>Traumatismo Severo</Portuguese>
</Key>
<Key ID="STR_ACE_Medical_GUI_traumaSustained4">
<English>Chronic Trauma</English>
<Portuguese>Traumatismo Crônico</Portuguese>
</Key>
</Package> </Package>
</Project> </Project>