]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Health analyzers now show if somebody is starving (#24789)
authorPieter-Jan Briers <pieterjan.briers+git@gmail.com>
Thu, 1 Feb 2024 06:28:17 +0000 (07:28 +0100)
committerGitHub <noreply@github.com>
Thu, 1 Feb 2024 06:28:17 +0000 (17:28 +1100)
"why are they getting cold damage" THERE YOU GO

Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs
Resources/Locale/en-US/medical/components/health-analyzer-component.ftl
Resources/Textures/Objects/Devices/health_analyzer.rsi/malnutrition.png [new file with mode: 0644]
Resources/Textures/Objects/Devices/health_analyzer.rsi/meta.json

index 9e786ce4365055c8f8e469999887344e87c9a382..588eb88502ed7473f9bdf37a7a94617100a8168d 100644 (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
             {
index 453bbdbb526b7a3b48b41a05b4b70be9bab3c491..d232be5c4d9c99f609a053f1b35946f8a9903ee4 100644 (file)
@@ -29,3 +29,5 @@ health-analyzer-window-damage-type-Radiation = Radiation
 
 health-analyzer-window-damage-group-Genetic = Genetic
 health-analyzer-window-damage-type-Cellular = Cellular
+
+health-analyzer-window-malnutrition = Severely malnourished
diff --git a/Resources/Textures/Objects/Devices/health_analyzer.rsi/malnutrition.png b/Resources/Textures/Objects/Devices/health_analyzer.rsi/malnutrition.png
new file mode 100644 (file)
index 0000000..edcfb61
Binary files /dev/null and b/Resources/Textures/Objects/Devices/health_analyzer.rsi/malnutrition.png differ
index 3fccf5c46b8a96a7dacc485ff5575bfbb8299445..bbf78c0b886b0aa889e22b81398d333cd622dd5f 100644 (file)
@@ -5,7 +5,7 @@
     "y": 32
   },
   "license": "CC-BY-SA-3.0",
-  "copyright": "airloss, brute, toxin and burn edited from /tg/station https://github.com/tgstation/tgstation/tree/master genetic edited from https://iconscout.com/free-icon/dna-2130814 with license CC BY 4.0",
+  "copyright": "airloss, brute, toxin and burn edited from /tg/station https://github.com/tgstation/tgstation/tree/master genetic edited from https://iconscout.com/free-icon/dna-2130814 with license CC BY 4.0. malnutrition from https://github.com/space-wizards/space-station-14/tree/73d7837fabb31a7691a1db47ff64903cbec5dd32/Resources/Textures/Interface/Alerts/hunger.rsi",
   "states": [
     {
       "name": "airloss"
@@ -24,6 +24,9 @@
     },
     {
       "name": "unknown"
+    },
+    {
+      "name": "malnutrition"
     }
   ]
-}
\ No newline at end of file
+}