]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make UnrevivableComponent shared, give the component reason messages and if it shows...
authorZachary Higgs <compgeek223@gmail.com>
Sun, 9 Feb 2025 23:16:21 +0000 (19:16 -0400)
committerGitHub <noreply@github.com>
Sun, 9 Feb 2025 23:16:21 +0000 (00:16 +0100)
* Make UnrevivableComponent shared

- Move UnrevivableComponent to shared

- add reason messages and if the status shows up in a health analyzer

* Update Content.Shared/Traits/Assorted/UnrevivableComponent.cs

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
* Make UnrevivableComponent networked

* Update Content.Shared/Traits/Assorted/UnrevivableComponent.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
---------

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Server/Medical/DefibrillatorSystem.cs
Content.Server/Medical/HealthAnalyzerSystem.cs
Content.Server/Traits/Assorted/UnrevivableComponent.cs [deleted file]
Content.Shared/Traits/Assorted/UnrevivableComponent.cs [new file with mode: 0644]

index 6bd563101b3d5ff6f18a8965a294e292d70a1dc2..ba272c92f51d46532bc727ca92512191ffdf38e5 100644 (file)
@@ -6,7 +6,7 @@ using Content.Server.EUI;
 using Content.Server.Ghost;
 using Content.Server.Popups;
 using Content.Server.PowerCell;
-using Content.Server.Traits.Assorted;
+using Content.Shared.Traits.Assorted;
 using Content.Shared.Damage;
 using Content.Shared.DoAfter;
 using Content.Shared.Interaction;
@@ -193,9 +193,9 @@ public sealed class DefibrillatorSystem : EntitySystem
             _chatManager.TrySendInGameICMessage(uid, Loc.GetString("defibrillator-rotten"),
                 InGameICChatType.Speak, true);
         }
-        else if (HasComp<UnrevivableComponent>(target))
+        else if (TryComp<UnrevivableComponent>(target, out var unrevivable))
         {
-            _chatManager.TrySendInGameICMessage(uid, Loc.GetString("defibrillator-unrevivable"),
+            _chatManager.TrySendInGameICMessage(uid, Loc.GetString(unrevivable.ReasonMessage),
                 InGameICChatType.Speak, true);
         }
         else
index 90646725bb7a36e14f9225472c71498f83bc3764..9f8ee92e3d741d1e5cf8bdea9d561ccd8a427626 100644 (file)
@@ -2,7 +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.Traits.Assorted;
 using Content.Shared.Chemistry.EntitySystems;
 using Content.Shared.Damage;
 using Content.Shared.DoAfter;
@@ -207,7 +207,7 @@ public sealed class HealthAnalyzerSystem : EntitySystem
             bleeding = bloodstream.BleedAmount > 0;
         }
 
-        if (HasComp<UnrevivableComponent>(target))
+        if (TryComp<UnrevivableComponent>(target, out var unrevivableComp) && unrevivableComp.Analyzable)
             unrevivable = true;
 
         _uiSystem.ServerSendUiMessage(healthAnalyzer, HealthAnalyzerUiKey.Key, new HealthAnalyzerScannedUserMessage(
diff --git a/Content.Server/Traits/Assorted/UnrevivableComponent.cs b/Content.Server/Traits/Assorted/UnrevivableComponent.cs
deleted file mode 100644 (file)
index b95c922..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace Content.Server.Traits.Assorted;
-
-/// <summary>
-/// This is used for the urevivable trait.
-/// </summary>
-[RegisterComponent]
-public sealed partial class UnrevivableComponent : Component
-{
-
-}
diff --git a/Content.Shared/Traits/Assorted/UnrevivableComponent.cs b/Content.Shared/Traits/Assorted/UnrevivableComponent.cs
new file mode 100644 (file)
index 0000000..19b4cac
--- /dev/null
@@ -0,0 +1,22 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Traits.Assorted;
+
+/// <summary>
+/// This is used for the unrevivable trait as well as generally preventing revival.
+/// </summary>
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
+public sealed partial class UnrevivableComponent : Component
+{
+    /// <summary>
+    /// A field to define if we should display the "Genetic incompatibility" warning on health analysers
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public bool Analyzable = true;
+
+    /// <summary>
+    /// The loc string used to provide a reason for being unrevivable
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public LocId ReasonMessage = "defibrillator-unrevivable";
+}