From df9d3f11cc71d020dfc520a0f35535071a85aa6e Mon Sep 17 00:00:00 2001 From: Kex Date: Sun, 14 Dec 2025 18:16:25 +0100 Subject: [PATCH 1/3] Implement SCR_InventoryHitZonePointUI::ACE_Medical_ShowGlobalStatTooltip --- .../UI/Inventory/ACE_Medical_EUIInfoType.c | 5 ++ .../Inventory/SCR_InventoryHitZonePointUI.c | 60 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/ACE_Medical_EUIInfoType.c create mode 100644 addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c diff --git a/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/ACE_Medical_EUIInfoType.c b/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/ACE_Medical_EUIInfoType.c new file mode 100644 index 000000000..974b409eb --- /dev/null +++ b/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/ACE_Medical_EUIInfoType.c @@ -0,0 +1,5 @@ +//------------------------------------------------------------------------------------------------ +[EnumBitFlag()] +enum ACE_Medical_EUIInfoType +{ +} diff --git a/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c b/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c new file mode 100644 index 000000000..dca18102d --- /dev/null +++ b/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------------------------ +//! Add more extensible implementation of ShowVirtualHZInfo for tooltips of new global stats +modded class SCR_InventoryHitZonePointUI : ScriptedWidgetComponent +{ + [Attribute(desc: "Medical info type for tooltip", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(ACE_Medical_EUIInfoType))] + protected ACE_Medical_EUIInfoType m_eACE_Medical_TooltipInfoType; + + //------------------------------------------------------------------------------------------------ + //! Override this to add specific info to m_DamageInfo associated with type + protected void ACE_Medical_ShowGlobalStatTooltip(Widget w, ACE_Medical_EUIInfoType type) + { + Widget localInfoWidget; + if (!m_DamageInfo) + { + SCR_InventoryMenuUI inventoryMenuUI = GetInventoryMenuUI(); + if (!inventoryMenuUI) + return; + + localInfoWidget = GetGame().GetWorkspace().CreateWidgets(DAMAGE_INFO, inventoryMenuUI.GetRootWidget()); + if (!localInfoWidget) + return; + + localInfoWidget.SetVisible(true); + localInfoWidget.SetOpacity(0); + + localInfoWidget.AddHandler(new SCR_InventoryDamageInfoUI()); + m_DamageInfo = SCR_InventoryDamageInfoUI.Cast(localInfoWidget.FindHandler(SCR_InventoryDamageInfoUI)); + } + + if (!m_DamageInfo) + return; + + m_DamageInfo.SetName(""); + + //callLater is here because the widget needs to be created before size can be determined and location can be set + GetGame().GetCallqueue().CallLater(EnableVirtualHZInfoWidget, 300, false, localInfoWidget, w); + } + + //------------------------------------------------------------------------------------------------ + override bool OnMouseEnter(Widget w, int x, int y) + { + super.OnMouseEnter(w, x, y); + + if (m_eACE_Medical_TooltipInfoType > 0) + ACE_Medical_ShowGlobalStatTooltip(w, m_eACE_Medical_TooltipInfoType); + + return false; + } + + //------------------------------------------------------------------------------------------------ + override bool OnMouseLeave(Widget w, Widget enterW, int x, int y) + { + super.OnMouseLeave(w, enterW, x, y); + + if (m_eACE_Medical_TooltipInfoType > 0) + HideVirtualHZInfo(); + + return false; + } +} From 49df2f314911184e066bf3ab71f50d22beb3217b Mon Sep 17 00:00:00 2001 From: Kex Date: Sun, 14 Dec 2025 18:28:19 +0100 Subject: [PATCH 2/3] Use flags as attribute widget instead --- .../UI/Inventory/SCR_InventoryHitZonePointUI.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c b/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c index dca18102d..728eb4798 100644 --- a/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c +++ b/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c @@ -2,7 +2,7 @@ //! Add more extensible implementation of ShowVirtualHZInfo for tooltips of new global stats modded class SCR_InventoryHitZonePointUI : ScriptedWidgetComponent { - [Attribute(desc: "Medical info type for tooltip", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(ACE_Medical_EUIInfoType))] + [Attribute(desc: "Medical info type for tooltip", uiwidget: UIWidgets.Flags, enumType: ACE_Medical_EUIInfoType)] protected ACE_Medical_EUIInfoType m_eACE_Medical_TooltipInfoType; //------------------------------------------------------------------------------------------------ From 7b1d128e2c2b3b9fb6004451d521ef1ddf37d323 Mon Sep 17 00:00:00 2001 From: Kex Date: Sun, 14 Dec 2025 18:31:58 +0100 Subject: [PATCH 3/3] Add comments --- .../UI/Inventory/SCR_InventoryHitZonePointUI.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c b/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c index 728eb4798..5f1d52cef 100644 --- a/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c +++ b/addons/medical_core/scripts/Game/@ACE_Medical_Core/UI/Inventory/SCR_InventoryHitZonePointUI.c @@ -6,6 +6,7 @@ modded class SCR_InventoryHitZonePointUI : ScriptedWidgetComponent protected ACE_Medical_EUIInfoType m_eACE_Medical_TooltipInfoType; //------------------------------------------------------------------------------------------------ + //! Create tooltip //! Override this to add specific info to m_DamageInfo associated with type protected void ACE_Medical_ShowGlobalStatTooltip(Widget w, ACE_Medical_EUIInfoType type) { @@ -37,6 +38,7 @@ modded class SCR_InventoryHitZonePointUI : ScriptedWidgetComponent } //------------------------------------------------------------------------------------------------ + //! Show tooltip override bool OnMouseEnter(Widget w, int x, int y) { super.OnMouseEnter(w, x, y); @@ -48,6 +50,7 @@ modded class SCR_InventoryHitZonePointUI : ScriptedWidgetComponent } //------------------------------------------------------------------------------------------------ + //! Hide tooltip override bool OnMouseLeave(Widget w, Widget enterW, int x, int y) { super.OnMouseLeave(w, enterW, x, y);