diff --git a/Content.Shared/Pulling/Components/PullableComponent.cs b/Content.Shared/Pulling/Components/PullableComponent.cs index 0463ce12a4..893f3709a8 100644 --- a/Content.Shared/Pulling/Components/PullableComponent.cs +++ b/Content.Shared/Pulling/Components/PullableComponent.cs @@ -28,7 +28,7 @@ namespace Content.Shared.Pulling.Components /// /// The current entity pulling this component. - /// Ideally, alter using TryStartPull and TryStopPull. + /// SharedPullingStateManagementSystem should be writing this. This means definitely not you. /// public IEntity? Puller { get; set; } /// @@ -57,7 +57,7 @@ namespace Content.Shared.Pulling.Components if (state.Puller == null) { - Puller = null; + EntitySystem.Get().ForceDisconnectPullable(this); return; } @@ -67,7 +67,21 @@ namespace Content.Shared.Pulling.Components return; } - Puller = entity; + if (Puller == entity) + { + // don't disconnect and reconnect a puller for no reason + return; + } + + if (!entity.TryGetComponent(out var comp)) + { + Logger.Error($"Entity {state.Puller.Value} for pulling had no Puller component"); + // ensure it disconnects from any different puller, still + EntitySystem.Get().ForceDisconnectPullable(this); + return; + } + + EntitySystem.Get().ForceRelationship(comp, this); } protected override void Shutdown()