From 941207c45cb23663a9ef9aa91b6bea16c60255c7 Mon Sep 17 00:00:00 2001 From: amsteadrayle <2516219+amsteadrayle@users.noreply.github.com> Date: Mon, 9 Oct 2023 13:57:47 -0400 Subject: [PATCH] Medical GUI - Peek Medical Info on Hit (#9467) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 * 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 Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/medical_gui/XEH_postInit.sqf | 18 ++++++++++++++++++ addons/medical_gui/initSettings.sqf | 18 ++++++++++++++++++ addons/medical_gui/stringtable.xml | 12 ++++++++++++ 3 files changed, 48 insertions(+) diff --git a/addons/medical_gui/XEH_postInit.sqf b/addons/medical_gui/XEH_postInit.sqf index a84e742bfe..7f89dca28c 100644 --- a/addons/medical_gui/XEH_postInit.sqf +++ b/addons/medical_gui/XEH_postInit.sqf @@ -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; diff --git a/addons/medical_gui/initSettings.sqf b/addons/medical_gui/initSettings.sqf index 5ae4474da0..1a408887af 100644 --- a/addons/medical_gui/initSettings.sqf +++ b/addons/medical_gui/initSettings.sqf @@ -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; diff --git a/addons/medical_gui/stringtable.xml b/addons/medical_gui/stringtable.xml index 5cb0fd4400..59f0ce8307 100644 --- a/addons/medical_gui/stringtable.xml +++ b/addons/medical_gui/stringtable.xml @@ -1265,6 +1265,18 @@ Показывать тяжесть кровопотери в списке ранений. Mostrar la pérdida de sangre cualitativa en la lista de heridas. + + Peek Medical Info on Hit + + + Temporarily show medical info when injured. + + + Medical Peek Duration on Hit + + + How long the medical info peek remains open after being injured. + Show Trauma Sustained Mostrar Traumatismo Sofrido