From 0e2c7167a5f83026e9407a77fa2043bc46daabb7 Mon Sep 17 00:00:00 2001
From: amsteadrayle <2516219+amsteadrayle@users.noreply.github.com>
Date: Sun, 8 Oct 2023 17:34:51 -0400
Subject: [PATCH] Medical GUI - Add keybind to show player's patient
information display (#9464)
* Add keybind to show patient information display
* Return false
* Add fadeout delay and associated setting
* Switch to CBA setting rounding
* Change setting type to time
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
* Fix incorrect behavior on repeated key presses
* Tweak setting name and description
* Tweak to prevent overlapping WUAE
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
---------
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
---
addons/medical_gui/XEH_postInit.sqf | 20 ++++++++++++++++++++
addons/medical_gui/initSettings.sqf | 9 +++++++++
addons/medical_gui/stringtable.xml | 9 +++++++++
3 files changed, 38 insertions(+)
diff --git a/addons/medical_gui/XEH_postInit.sqf b/addons/medical_gui/XEH_postInit.sqf
index 6127a1a013..a84e742bfe 100644
--- a/addons/medical_gui/XEH_postInit.sqf
+++ b/addons/medical_gui/XEH_postInit.sqf
@@ -12,6 +12,8 @@ GVAR(pendingReopen) = false;
GVAR(menuPFH) = -1;
+GVAR(peekLastOpenedOn) = -1;
+
GVAR(selfInteractionActions) = [];
[] call FUNC(addTreatmentActions);
[] call FUNC(collectActions);
@@ -71,6 +73,24 @@ GVAR(selfInteractionActions) = [];
false
}, [DIK_H, [false, false, false]], false, 0] call CBA_fnc_addKeybind;
+["ACE3 Common", QGVAR(peekMedicalInfoKey), localize LSTRING(PeekMedicalInfo),
+{
+ // Conditions: canInteract
+ if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
+
+ // Statement
+ [ACE_player, 0] call FUNC(displayPatientInformation);
+ false
+}, {
+ if (CBA_missionTime - GVAR(peekLastOpenedOn) > GVAR(peekMedicalInfoReleaseDelay)) then {
+ [{
+ CBA_missionTime - GVAR(peekLastOpenedOn) > GVAR(peekMedicalInfoReleaseDelay)
+ }, {QGVAR(RscPatientInfo) cutFadeOut 0.3}] call CBA_fnc_waitUntilAndExecute;
+ };
+ GVAR(peekLastOpenedOn) = CBA_missionTime;
+ false
+}, [DIK_H, [false, true, false]], false, 0] call CBA_fnc_addKeybind;
+
// Close patient information display when interaction menu is closed
["ace_interactMenuClosed", {
diff --git a/addons/medical_gui/initSettings.sqf b/addons/medical_gui/initSettings.sqf
index c1d02d7131..5ae4474da0 100644
--- a/addons/medical_gui/initSettings.sqf
+++ b/addons/medical_gui/initSettings.sqf
@@ -126,3 +126,12 @@ private _categoryColors = [ELSTRING(medical,Category), format ["| %1 |", LELSTRI
true,
true // isGlobal
] call CBA_fnc_addSetting;
+
+[
+ QGVAR(peekMedicalInfoReleaseDelay),
+ "TIME",
+ [LSTRING(PeekMedicalInfoReleaseDelay_DisplayName), LSTRING(PeekMedicalInfoReleaseDelay_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 c2eb8c8e73..5cb0fd4400 100644
--- a/addons/medical_gui/stringtable.xml
+++ b/addons/medical_gui/stringtable.xml
@@ -282,6 +282,15 @@
開起醫療選單
Medikal Menüyü Aç
+
+ Peek Medical Info
+
+
+ Medical Peek Duration
+
+
+ How long the medical info peek remains open after releasing the key.
+
Load Patient
Cargar al paciente en