Fix pulling mispredicts (#22941)

* Fix pulling mispredicts

* Make behaviour consistent

* Good ol terminating entities
This commit is contained in:
Leon Friedrich
2023-12-25 02:33:32 -05:00
committed by GitHub
parent 9eaa4c3a5d
commit 721a445bbd
8 changed files with 42 additions and 77 deletions

View File

@@ -12,6 +12,8 @@ using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Content.Shared.Pulling
{
@@ -23,6 +25,7 @@ namespace Content.Shared.Pulling
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly IGameTiming _timing = default!;
public bool CanPull(EntityUid puller, EntityUid pulled)
{
@@ -90,6 +93,9 @@ namespace Content.Shared.Pulling
public bool TryStopPull(SharedPullableComponent pullable, EntityUid? user = null)
{
if (_timing.ApplyingState)
return false;
if (!pullable.BeingPulled)
{
return false;
@@ -127,6 +133,9 @@ namespace Content.Shared.Pulling
// The main "start pulling" function.
public bool TryStartPull(SharedPullerComponent puller, SharedPullableComponent pullable)
{
if (_timing.ApplyingState)
return false;
if (puller.Pulling == pullable.Owner)
return true;