Make UnrevivableComponent shared, give the component reason messages and if it shows up on the analyzer (#35013)
* 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>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
22
Content.Shared/Traits/Assorted/UnrevivableComponent.cs
Normal file
22
Content.Shared/Traits/Assorted/UnrevivableComponent.cs
Normal file
@@ -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";
|
||||
}
|
||||
Reference in New Issue
Block a user