From dc38cc6074e20cb6608210555030b627a20a68d5 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Fri, 8 Jul 2022 06:30:02 +1200 Subject: [PATCH] Content changes required for recursive deletion changes (#9316) --- Content.Server/Buckle/Systems/BuckleSystem.cs | 6 ------ .../Gravity/EntitySystems/GravityGeneratorSystem.cs | 10 ++++++++++ Content.Shared/Follower/FollowerSystem.cs | 11 +++++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Content.Server/Buckle/Systems/BuckleSystem.cs b/Content.Server/Buckle/Systems/BuckleSystem.cs index 685c293557..81b7b4b242 100644 --- a/Content.Server/Buckle/Systems/BuckleSystem.cs +++ b/Content.Server/Buckle/Systems/BuckleSystem.cs @@ -24,10 +24,8 @@ namespace Content.Server.Buckle.Systems SubscribeLocalEvent(RotateEvent); - SubscribeLocalEvent(ContainerModifiedBuckle); SubscribeLocalEvent(ContainerModifiedStrap); - SubscribeLocalEvent(ContainerModifiedBuckle); SubscribeLocalEvent(ContainerModifiedStrap); SubscribeLocalEvent(HandleInteractHand); @@ -97,10 +95,6 @@ namespace Content.Server.Buckle.Systems } } - private void ContainerModifiedBuckle(EntityUid uid, BuckleComponent buckle, ContainerModifiedMessage message) - { - ContainerModifiedReAttach(buckle, buckle.BuckledTo); - } private void ContainerModifiedStrap(EntityUid uid, StrapComponent strap, ContainerModifiedMessage message) { foreach (var buckledEntity in strap.BuckledEntities) diff --git a/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs b/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs index 8c9832ae62..aea04c0391 100644 --- a/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs +++ b/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs @@ -21,11 +21,21 @@ namespace Content.Server.Gravity.EntitySystems SubscribeLocalEvent(OnComponentInitialized); SubscribeLocalEvent(OnComponentShutdown); + SubscribeLocalEvent(OnParentChanged); // Or just anchor changed? SubscribeLocalEvent(OnInteractHand); SubscribeLocalEvent( OnSwitchGenerator); } + private void OnParentChanged(EntityUid uid, GravityGeneratorComponent component, ref EntParentChangedMessage args) + { + // TODO consider stations with more than one generator. + if (component.GravityActive && TryComp(args.OldParent, out GravityComponent? gravity)) + _gravitySystem.DisableGravity(gravity); + + UpdateGravityActive(component, false); + } + private void OnComponentShutdown(EntityUid uid, GravityGeneratorComponent component, ComponentShutdown args) { component.GravityActive = false; diff --git a/Content.Shared/Follower/FollowerSystem.cs b/Content.Shared/Follower/FollowerSystem.cs index 32ca86ce7c..00fbb518ff 100644 --- a/Content.Shared/Follower/FollowerSystem.cs +++ b/Content.Shared/Follower/FollowerSystem.cs @@ -1,8 +1,9 @@ -using Content.Shared.Database; +using Content.Shared.Database; using Content.Shared.Follower.Components; using Content.Shared.Ghost; using Content.Shared.Movement.Events; using Content.Shared.Verbs; +using Robust.Shared.Map; namespace Content.Shared.Follower; @@ -100,7 +101,13 @@ public sealed class FollowerSystem : EntitySystem RemComp(target); RemComp(uid); - Transform(uid).AttachToGridOrMap(); + var xform = Transform(uid); + xform.AttachToGridOrMap(); + if (xform.MapID == MapId.Nullspace) + { + Del(uid); + return; + } RemComp(uid);