From e6c4977709d462850fe924c0cf073456574e15a6 Mon Sep 17 00:00:00 2001 From: Mnemotechnican <69920617+Mnemotechnician@users.noreply.github.com> Date: Fri, 29 Dec 2023 20:09:12 +0300 Subject: [PATCH] QOL changes on the matter of life and death (#782) * Fix cremation accepting connected players * Fix ghostrespawn * Support for components that are carried over to cloned bodies * Whitespace --- Content.Server/Body/Systems/BodySystem.cs | 3 ++- Content.Server/Cloning/CloningSystem.cs | 16 ++++++++++++++++ Content.Server/Morgue/CrematoriumSystem.cs | 15 +++++++++++++++ .../Item/PseudoItem/PseudoItemComponent.cs | 4 +++- .../_NF/SizeAttribute/SizeAttributeComponent.cs | 4 +++- .../_NF/Cloning/ITransferredByCloning.cs | 9 +++++++++ 6 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 Content.Shared/_NF/Cloning/ITransferredByCloning.cs diff --git a/Content.Server/Body/Systems/BodySystem.cs b/Content.Server/Body/Systems/BodySystem.cs index 242b02d78c1..b55cb70cf9b 100644 --- a/Content.Server/Body/Systems/BodySystem.cs +++ b/Content.Server/Body/Systems/BodySystem.cs @@ -42,7 +42,8 @@ private void OnRelayMoveInput(EntityUid uid, BodyComponent component, ref MoveIn { if (_mobState.IsDead(uid) && _mindSystem.TryGetMind(uid, out var mindId, out var mind)) { - mind.TimeOfDeath ??= _gameTiming.RealTime; + // mind.TimeOfDeath ??= _gameTiming.RealTime; + mind.TimeOfDeath ??= _gameTiming.CurTime; // Frontier - fix returning to body messing with the your TOD _ticker.OnGhostAttempt(mindId, true, mind: mind); } } diff --git a/Content.Server/Cloning/CloningSystem.cs b/Content.Server/Cloning/CloningSystem.cs index 7eefe02a53c..9749ec28dfc 100644 --- a/Content.Server/Cloning/CloningSystem.cs +++ b/Content.Server/Cloning/CloningSystem.cs @@ -37,7 +37,9 @@ using Content.Shared.Emag.Systems; using Content.Server.Popups; using Content.Server.Traits.Assorted; +using Content.Shared._NF.Cloning; using Content.Shared.Bank.Components; +using Robust.Shared.Serialization.Manager; namespace Content.Server.Cloning { @@ -65,6 +67,8 @@ public sealed class CloningSystem : EntitySystem [Dependency] private readonly SharedMindSystem _mindSystem = default!; [Dependency] private readonly MetaDataSystem _metaSystem = default!; [Dependency] private readonly SharedJobSystem _jobs = default!; + // Frontier + [Dependency] private readonly ISerializationManager _serialization = default!; public readonly Dictionary ClonesWaitingForMind = new(); public const float EasyModeCloningCost = 0.7f; @@ -255,6 +259,18 @@ public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Entity(entity, out var comp) && !_mobState.IsDead(entity, comp)) + return false; + if (_mind.TryGetMind(entity, out var _, out var mind) && mind.Session?.State?.Status == SessionStatus.InGame) + return false; + return Cremate(uid, component, storage); } diff --git a/Content.Server/Nyanotrasen/Item/PseudoItem/PseudoItemComponent.cs b/Content.Server/Nyanotrasen/Item/PseudoItem/PseudoItemComponent.cs index 4844441a9ba..73ff83f0d1d 100644 --- a/Content.Server/Nyanotrasen/Item/PseudoItem/PseudoItemComponent.cs +++ b/Content.Server/Nyanotrasen/Item/PseudoItem/PseudoItemComponent.cs @@ -1,4 +1,6 @@ +using Content.Shared._NF.Cloning; + namespace Content.Server.Item.PseudoItem { /// @@ -6,7 +8,7 @@ namespace Content.Server.Item.PseudoItem /// but not under most conditions. /// [RegisterComponent] - public sealed partial class PseudoItemComponent : Component + public sealed partial class PseudoItemComponent : Component, ITransferredByCloning { [DataField("size")] public int Size = 120; diff --git a/Content.Server/_NF/SizeAttribute/SizeAttributeComponent.cs b/Content.Server/_NF/SizeAttribute/SizeAttributeComponent.cs index 0cb88abe587..4c9926c274b 100644 --- a/Content.Server/_NF/SizeAttribute/SizeAttributeComponent.cs +++ b/Content.Server/_NF/SizeAttribute/SizeAttributeComponent.cs @@ -1,8 +1,10 @@ +using Content.Shared._NF.Cloning; + namespace Content.Server.SizeAttribute { [RegisterComponent] - public sealed partial class SizeAttributeComponent : Component + public sealed partial class SizeAttributeComponent : Component, ITransferredByCloning { [DataField("short")] public bool Short = false; diff --git a/Content.Shared/_NF/Cloning/ITransferredByCloning.cs b/Content.Shared/_NF/Cloning/ITransferredByCloning.cs new file mode 100644 index 00000000000..e51136e9f16 --- /dev/null +++ b/Content.Shared/_NF/Cloning/ITransferredByCloning.cs @@ -0,0 +1,9 @@ +namespace Content.Shared._NF.Cloning; + +/// +/// Indicates that this Component should be transferred to the new entity when the entity is cloned (for example, using a cloner) +/// +public interface ITransferredByCloning +{ +} +