From 6ec02db63f309a1cc17c883ec5c11be197e74b8f Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Mon, 9 Oct 2023 00:49:20 -0400 Subject: [PATCH] Make MMIs work again (#20844) --- Content.Server/Body/Systems/BrainSystem.cs | 19 ++++--------------- .../Body/Systems/SharedBodySystem.Body.cs | 2 +- .../Body/Systems/SharedBodySystem.Parts.cs | 2 +- Resources/Prototypes/Body/Organs/diona.yml | 2 ++ Resources/Prototypes/Body/Organs/human.yml | 2 ++ 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Content.Server/Body/Systems/BrainSystem.cs b/Content.Server/Body/Systems/BrainSystem.cs index 16a2a6737b..b55274808d 100644 --- a/Content.Server/Body/Systems/BrainSystem.cs +++ b/Content.Server/Body/Systems/BrainSystem.cs @@ -2,17 +2,13 @@ using Content.Server.Body.Components; using Content.Server.Ghost.Components; using Content.Shared.Body.Components; using Content.Shared.Body.Events; -using Content.Shared.Body.Organ; using Content.Shared.Mind; using Content.Shared.Mind.Components; -using Content.Shared.Movement.Components; -using Content.Shared.Movement.Systems; namespace Content.Server.Body.Systems { public sealed class BrainSystem : EntitySystem { - [Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!; [Dependency] private readonly SharedMindSystem _mindSystem = default!; public override void Initialize() @@ -20,11 +16,14 @@ namespace Content.Server.Body.Systems base.Initialize(); SubscribeLocalEvent((uid, _, args) => HandleMind(args.Body, uid)); - SubscribeLocalEvent((uid, _, args) => HandleMind(args.OldBody, uid)); + SubscribeLocalEvent((uid, _, args) => HandleMind(uid, args.OldBody)); } private void HandleMind(EntityUid newEntity, EntityUid oldEntity) { + if (TerminatingOrDeleted(newEntity) || TerminatingOrDeleted(oldEntity)) + return; + EnsureComp(newEntity); EnsureComp(oldEntity); @@ -32,16 +31,6 @@ namespace Content.Server.Body.Systems if (HasComp(newEntity)) ghostOnMove.MustBeDead = true; - // TODO: This is an awful solution. - // Our greatest minds still can't figure out how to allow brains/heads to ghost without giving them the - // ability to move first. I hate this with a passion. - if (!HasComp(newEntity)) - { - AddComp(newEntity); - var move = EnsureComp(newEntity); - _movementSpeed.ChangeBaseSpeed(newEntity, 0, 0 , 0, move); - } - if (!_mindSystem.TryGetMind(oldEntity, out var mindId, out var mind)) return; diff --git a/Content.Shared/Body/Systems/SharedBodySystem.Body.cs b/Content.Shared/Body/Systems/SharedBodySystem.Body.cs index 9cdeb8dcfa..8f16ca8efc 100644 --- a/Content.Shared/Body/Systems/SharedBodySystem.Body.cs +++ b/Content.Shared/Body/Systems/SharedBodySystem.Body.cs @@ -55,7 +55,7 @@ public partial class SharedBodySystem private void OnBodyRemoved(EntityUid uid, BodyComponent component, EntRemovedFromContainerMessage args) { // TODO: lifestage shenanigans - if (LifeStage(uid) >= EntityLifeStage.Terminating) + if (TerminatingOrDeleted(uid)) return; // Root body part? diff --git a/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs b/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs index d2ec8c7f18..66397017e1 100644 --- a/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs +++ b/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs @@ -47,7 +47,7 @@ public partial class SharedBodySystem private void OnBodyPartRemoved(EntityUid uid, BodyPartComponent component, EntRemovedFromContainerMessage args) { // TODO: lifestage shenanigans - if (LifeStage(uid) >= EntityLifeStage.Terminating) + if (TerminatingOrDeleted(uid)) return; // Body part removed from another body part. diff --git a/Resources/Prototypes/Body/Organs/diona.yml b/Resources/Prototypes/Body/Organs/diona.yml index 52087f062a..482ec42927 100644 --- a/Resources/Prototypes/Body/Organs/diona.yml +++ b/Resources/Prototypes/Body/Organs/diona.yml @@ -49,6 +49,8 @@ - ReagentId: Nutriment Quantity: 5 - type: Brain + - type: InputMover + - type: Examiner - type: Lung #lungs in they head. why they there tho? - type: Metabolizer removeEmpty: true diff --git a/Resources/Prototypes/Body/Organs/human.yml b/Resources/Prototypes/Body/Organs/human.yml index 91142e8def..1ece318f1d 100644 --- a/Resources/Prototypes/Body/Organs/human.yml +++ b/Resources/Prototypes/Body/Organs/human.yml @@ -36,6 +36,8 @@ - type: Input context: "ghost" - type: Brain + - type: InputMover + - type: Examiner - type: BlockMovement - type: entity -- 2.51.2