Health analyzers now show if somebody is starving (#24789)

"why are they getting cold damage" THERE YOU GO
This commit is contained in:
Pieter-Jan Briers
2024-02-01 07:28:17 +01:00
committed by GitHub
parent d061c164fa
commit c25ddfd638
4 changed files with 24 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
using Content.Shared.IdentityManagement;
using Content.Shared.MedicalScanner;
using Content.Shared.Nutrition.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
@@ -12,6 +13,7 @@ using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
@@ -85,6 +87,19 @@ namespace Content.Client.HealthAnalyzer.UI
DrawDiagnosticGroups(damageSortedGroups, damagePerType);
if (_entityManager.TryGetComponent(target, out HungerComponent? hunger)
&& hunger.StarvationDamage != null
&& hunger.CurrentThreshold <= HungerThreshold.Starving)
{
var box = new Control { Margin = new Thickness(0, 0, 0, 15) };
box.AddChild(CreateDiagnosticGroupTitle(
Loc.GetString("health-analyzer-window-malnutrition"),
"malnutrition"));
GroupsContainer.AddChild(box);
}
SetHeight = AnalyzerHeight;
SetWidth = AnalyzerWidth;
}
@@ -113,7 +128,7 @@ namespace Content.Client.HealthAnalyzer.UI
Orientation = BoxContainer.LayoutOrientation.Vertical,
};
groupContainer.AddChild(CreateDiagnosticGroupTitle(groupTitleText, damageGroupId, damageAmount.Int()));
groupContainer.AddChild(CreateDiagnosticGroupTitle(groupTitleText, damageGroupId));
GroupsContainer.AddChild(groupContainer);
@@ -166,7 +181,7 @@ namespace Content.Client.HealthAnalyzer.UI
};
}
private BoxContainer CreateDiagnosticGroupTitle(string text, string id, int damageAmount)
private BoxContainer CreateDiagnosticGroupTitle(string text, string id)
{
var rootContainer = new BoxContainer
{