]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add health analyzer unrevivability warning (#32636)
authorSaphire Lattice <lattice@saphi.re>
Sat, 26 Oct 2024 17:22:08 +0000 (00:22 +0700)
committerGitHub <noreply@github.com>
Sat, 26 Oct 2024 17:22:08 +0000 (19:22 +0200)
* Add health analyzer unrevivability warning

* Remove errornous comment

Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml
Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs
Content.Server/Medical/CryoPodSystem.cs
Content.Server/Medical/HealthAnalyzerSystem.cs
Content.Shared/MedicalScanner/HealthAnalyzerScannedUserMessage.cs
Resources/Locale/en-US/medical/components/health-analyzer-component.ftl

index 19d00a0bbf8b1d89fe94763d1ed638aa5e8ce828..aae8785b1fe1080360549b68ae4a4615c0cdcf01 100644 (file)
@@ -47,8 +47,7 @@
 
             <PanelContainer Name="AlertsDivider" Visible="False" StyleClasses="LowDivider" />
 
-            <BoxContainer Name="AlertsContainer" Visible="False" Margin="0 5" Orientation="Horizontal"
-                          HorizontalExpand="True" HorizontalAlignment="Center">
+            <BoxContainer Name="AlertsContainer" Visible="False" Margin="0 5" Orientation="Vertical" HorizontalAlignment="Center">
 
             </BoxContainer>
 
index d61267d002c6b5c4805c1c96c825b07088b69a5e..fd3615d59f5897c720979d1388b22707f6004d64 100644 (file)
@@ -110,18 +110,29 @@ namespace Content.Client.HealthAnalyzer.UI
 
             // Alerts
 
-            AlertsDivider.Visible = msg.Bleeding == true;
-            AlertsContainer.Visible = msg.Bleeding == true;
+            var showAlerts = msg.Unrevivable == true || msg.Bleeding == true;
 
-            if (msg.Bleeding == true)
-            {
+            AlertsDivider.Visible = showAlerts;
+            AlertsContainer.Visible = showAlerts;
+
+            if (showAlerts)
                 AlertsContainer.DisposeAllChildren();
-                AlertsContainer.AddChild(new Label
+
+            if (msg.Unrevivable == true)
+                AlertsContainer.AddChild(new RichTextLabel
+                {
+                    Text = Loc.GetString("health-analyzer-window-entity-unrevivable-text"),
+                    Margin = new Thickness(0, 4),
+                    MaxWidth = 300
+                });
+
+            if (msg.Bleeding == true)
+                AlertsContainer.AddChild(new RichTextLabel
                 {
                     Text = Loc.GetString("health-analyzer-window-entity-bleeding-text"),
-                    FontColorOverride = Color.Red,
+                    Margin = new Thickness(0, 4),
+                    MaxWidth = 300
                 });
-            }
 
             // Damage Groups
 
index fc9ab081d2660615b712095fed7987d59ddba74c..15fe2a69cf97dfdad5f22a60ab528ad6dd05b960 100644 (file)
@@ -201,6 +201,7 @@ public sealed partial class CryoPodSystem : SharedCryoPodSystem
                 ? bloodSolution.FillFraction
                 : 0,
             null,
+            null,
             null
         ));
     }
index 60a492a755fe0a6d1451fba85a42101559cbe2f9..90646725bb7a36e14f9225472c71498f83bc3764 100644 (file)
@@ -2,6 +2,7 @@ using Content.Server.Body.Components;
 using Content.Server.Medical.Components;
 using Content.Server.PowerCell;
 using Content.Server.Temperature.Components;
+using Content.Server.Traits.Assorted;
 using Content.Shared.Chemistry.EntitySystems;
 using Content.Shared.Damage;
 using Content.Shared.DoAfter;
@@ -196,6 +197,7 @@ public sealed class HealthAnalyzerSystem : EntitySystem
 
         var bloodAmount = float.NaN;
         var bleeding = false;
+        var unrevivable = false;
 
         if (TryComp<BloodstreamComponent>(target, out var bloodstream) &&
             _solutionContainerSystem.ResolveSolution(target, bloodstream.BloodSolutionName,
@@ -205,12 +207,16 @@ public sealed class HealthAnalyzerSystem : EntitySystem
             bleeding = bloodstream.BleedAmount > 0;
         }
 
+        if (HasComp<UnrevivableComponent>(target))
+            unrevivable = true;
+
         _uiSystem.ServerSendUiMessage(healthAnalyzer, HealthAnalyzerUiKey.Key, new HealthAnalyzerScannedUserMessage(
             GetNetEntity(target),
             bodyTemperature,
             bloodAmount,
             scanMode,
-            bleeding
+            bleeding,
+            unrevivable
         ));
     }
 }
index 78f26ed5c02f98f26258b5ba026a2640ef7bbd37..08af1a36a7b9ac8ee1078d2c39b4f039bd664dca 100644 (file)
@@ -13,14 +13,16 @@ public sealed class HealthAnalyzerScannedUserMessage : BoundUserInterfaceMessage
     public float BloodLevel;
     public bool? ScanMode;
     public bool? Bleeding;
+    public bool? Unrevivable;
 
-    public HealthAnalyzerScannedUserMessage(NetEntity? targetEntity, float temperature, float bloodLevel, bool? scanMode, bool? bleeding)
+    public HealthAnalyzerScannedUserMessage(NetEntity? targetEntity, float temperature, float bloodLevel, bool? scanMode, bool? bleeding, bool? unrevivable)
     {
         TargetEntity = targetEntity;
         Temperature = temperature;
         BloodLevel = bloodLevel;
         ScanMode = scanMode;
         Bleeding = bleeding;
+        Unrevivable = unrevivable;
     }
 }
 
index fe1f92e91406d11609184046f25bf19b49f24748..eb79358ecc25114e9b76de56e96a91c1e53d6e60 100644 (file)
@@ -15,7 +15,8 @@ health-analyzer-window-entity-damage-total-text = Total Damage:
 health-analyzer-window-damage-group-text = {$damageGroup}: {$amount}
 health-analyzer-window-damage-type-text = {$damageType}: {$amount}
 
-health-analyzer-window-entity-bleeding-text = Patient is bleeding!
+health-analyzer-window-entity-unrevivable-text = [color=red]Unique body composition detected! Patient can not be resuscitated by normal means![/color]
+health-analyzer-window-entity-bleeding-text = [color=red]Patient is bleeding![/color]
 
 health-analyzer-window-scan-mode-text = Scan Mode:
 health-analyzer-window-scan-mode-active = Active