diff --git a/Content.Server/Medical/DefibrillatorSystem.cs b/Content.Server/Medical/DefibrillatorSystem.cs index 6bd563101b..ba272c92f5 100644 --- a/Content.Server/Medical/DefibrillatorSystem.cs +++ b/Content.Server/Medical/DefibrillatorSystem.cs @@ -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(target)) + else if (TryComp(target, out var unrevivable)) { - _chatManager.TrySendInGameICMessage(uid, Loc.GetString("defibrillator-unrevivable"), + _chatManager.TrySendInGameICMessage(uid, Loc.GetString(unrevivable.ReasonMessage), InGameICChatType.Speak, true); } else diff --git a/Content.Server/Medical/HealthAnalyzerSystem.cs b/Content.Server/Medical/HealthAnalyzerSystem.cs index 90646725bb..9f8ee92e3d 100644 --- a/Content.Server/Medical/HealthAnalyzerSystem.cs +++ b/Content.Server/Medical/HealthAnalyzerSystem.cs @@ -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(target)) + if (TryComp(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 index b95c922d54..0000000000 --- a/Content.Server/Traits/Assorted/UnrevivableComponent.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Content.Server.Traits.Assorted; - -/// -/// This is used for the urevivable trait. -/// -[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 index 0000000000..19b4cac5e0 --- /dev/null +++ b/Content.Shared/Traits/Assorted/UnrevivableComponent.cs @@ -0,0 +1,22 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Traits.Assorted; + +/// +/// This is used for the unrevivable trait as well as generally preventing revival. +/// +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +public sealed partial class UnrevivableComponent : Component +{ + /// + /// A field to define if we should display the "Genetic incompatibility" warning on health analysers + /// + [DataField, AutoNetworkedField] + public bool Analyzable = true; + + /// + /// The loc string used to provide a reason for being unrevivable + /// + [DataField, AutoNetworkedField] + public LocId ReasonMessage = "defibrillator-unrevivable"; +}