Medical GUI - Peek Medical Info on Hit (#9467)

* Basic implementation of medical status peek on hit

* Fix flickering on repeated hits

* Overhaul to show damaged body part

* Add setting to enable/disable

* Add setting for duration

* Fix capitalization

Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>

* Use recommended equality check

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>

* Default to off

* change setting limits

---------

Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
This commit is contained in:
amsteadrayle 2023-10-09 13:57:47 -04:00 committed by GitHub
parent 97febbe574
commit 941207c45c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 0 deletions

View File

@ -13,6 +13,7 @@ GVAR(pendingReopen) = false;
GVAR(menuPFH) = -1;
GVAR(peekLastOpenedOn) = -1;
GVAR(peekOnHitLastOpenedOn) = -1;
GVAR(selfInteractionActions) = [];
[] call FUNC(addTreatmentActions);
@ -96,3 +97,20 @@ GVAR(selfInteractionActions) = [];
["ace_interactMenuClosed", {
QGVAR(RscPatientInfo) cutFadeOut 0.3;
}] call CBA_fnc_addEventHandler;
[QEGVAR(medical,woundReceived), {
params ["_unit", "_allDamages", ""];
if !(GVAR(peekMedicalOnHit) && {_unit == ACE_player}) exitWith {};
private _bodypart = toLower (_allDamages select 0 select 1);
private _bodypartIndex = ALL_BODY_PARTS find _bodypart;
[ACE_player, _bodypartIndex] call FUNC(displayPatientInformation);
if (CBA_missionTime - GVAR(peekOnHitLastOpenedOn) > GVAR(peekMedicalOnHitDuration)) then {
[{
CBA_missionTime - GVAR(peekOnHitLastOpenedOn) > GVAR(peekMedicalOnHitDuration)
}, {QGVAR(RscPatientInfo) cutFadeOut 0.3}] call CBA_fnc_waitUntilAndExecute;
};
GVAR(peekOnHitLastOpenedOn) = CBA_missionTime;
}] call CBA_fnc_addEventHandler;

View File

@ -135,3 +135,21 @@ private _categoryColors = [ELSTRING(medical,Category), format ["| %1 |", LELSTRI
[0, 5, 1],
false
] call CBA_fnc_addSetting;
[
QGVAR(peekMedicalOnHit),
"CHECKBOX",
[LSTRING(PeekMedicalOnHit_DisplayName), LSTRING(PeekMedicalOnHit_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory)],
false,
false // isGlobal
] call CBA_fnc_addSetting;
[
QGVAR(peekMedicalOnHitDuration),
"TIME",
[LSTRING(PeekMedicalOnHitDuration_DisplayName), LSTRING(PeekMedicalOnHitDuration_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory)],
[0, 5, 1],
false
] call CBA_fnc_addSetting;

View File

@ -1265,6 +1265,18 @@
<Russian>Показывать тяжесть кровопотери в списке ранений.</Russian>
<Spanish>Mostrar la pérdida de sangre cualitativa en la lista de heridas.</Spanish>
</Key>
<Key ID="STR_ACE_Medical_GUI_PeekMedicalOnHit_DisplayName">
<English>Peek Medical Info on Hit</English>
</Key>
<Key ID="STR_ACE_Medical_GUI_PeekMedicalOnHit_Description">
<English>Temporarily show medical info when injured.</English>
</Key>
<Key ID="STR_ACE_Medical_GUI_PeekMedicalOnHitDuration_DisplayName">
<English>Medical Peek Duration on Hit</English>
</Key>
<Key ID="STR_ACE_Medical_GUI_PeekMedicalOnHitDuration_Description">
<English>How long the medical info peek remains open after being injured.</English>
</Key>
<Key ID="STR_ACE_Medical_GUI_showDamageEntry_DisplayName">
<English>Show Trauma Sustained</English>
<Portuguese>Mostrar Traumatismo Sofrido</Portuguese>