diff --git a/Content.Server/Physics/Controllers/PullController.cs b/Content.Server/Physics/Controllers/PullController.cs index fc93d4cf46..dd7271b49e 100644 --- a/Content.Server/Physics/Controllers/PullController.cs +++ b/Content.Server/Physics/Controllers/PullController.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Content.Shared.Pulling; +using Content.Shared.Pulling.Components; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; @@ -23,7 +24,7 @@ namespace Content.Server.Physics.Controllers private const float AccelModifierLowMass = 5.0f; // roundstart saltern emergency crowbar // Used to control settling (turns off pulling). private const float MaximumSettleVelocity = 0.1f; - private const float MaximumSettleDistance = 0.01f; + private const float MaximumSettleDistance = 0.1f; // Settle shutdown control. // Mustn't be too massive, as that causes severe mispredicts *and can prevent it ever resolving*. // Exists to bleed off "I pulled my crowbar" overshoots. @@ -39,10 +40,19 @@ namespace Content.Server.Physics.Controllers public override void Initialize() { UpdatesAfter.Add(typeof(MoverController)); + SubscribeLocalEvent(OnPullerMove); base.Initialize(); } + private void OnPullerMove(EntityUid uid, SharedPullerComponent component, ref MoveEvent args) + { + if (component.Pulling == null || + !TryComp(component.Pulling.Value, out var pullable)) return; + + _pullableSystem.StopMoveTo(pullable); + } + public override void UpdateBeforeSolve(bool prediction, float frameTime) { base.UpdateBeforeSolve(prediction, frameTime); diff --git a/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs index 95f9d7a8cb..6c66af681f 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs @@ -135,8 +135,8 @@ namespace Content.Shared.Pulling RaiseLocalEvent(pullable.Owner, message); // Networking - puller.Dirty(); - pullable.Dirty(); + Dirty(puller); + Dirty(pullable); } } diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs index a36aec2a14..e87bcd3819 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs @@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis; using Content.Shared.Alert; using Content.Shared.GameTicking; using Content.Shared.Input; +using Content.Shared.Movement.Components; using Content.Shared.Physics.Pull; using Content.Shared.Pulling.Components; using Content.Shared.Rotatable; @@ -106,7 +107,7 @@ namespace Content.Shared.Pulling { if (args.Pulled.Owner != uid) return; - + _alertsSystem.ShowAlert(component.Owner, AlertType.Pulled); } @@ -217,6 +218,10 @@ namespace Content.Shared.Pulling return false; } + if (_containerSystem.IsEntityInContainer(player) || + player.IsWeightless(entityManager: EntityManager)) + return false; + TryMoveTo(pullable, coords); return false;