Fix pulling lerping (#4550)
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
|
using Content.Shared.Body.Components;
|
||||||
|
using Content.Shared.MobState;
|
||||||
using Content.Shared.Movement;
|
using Content.Shared.Movement;
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
|
using Content.Shared.Pulling.Components;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -32,6 +35,30 @@ namespace Content.Client.Physics.Controllers
|
|||||||
joint.BodyB.Predict = true;
|
joint.BodyB.Predict = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're being pulled then we won't predict anything and will receive server lerps so it looks way smoother.
|
||||||
|
if (player.TryGetComponent(out SharedPullableComponent? pullableComp))
|
||||||
|
{
|
||||||
|
var puller = pullableComp.Puller;
|
||||||
|
if (puller != null && puller.TryGetComponent<PhysicsComponent>(out var pullerBody))
|
||||||
|
{
|
||||||
|
pullerBody.Predict = false;
|
||||||
|
body.Predict = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're pulling a mob then make sure that isn't predicted so it doesn't fuck our velocity up.
|
||||||
|
if (player.TryGetComponent(out SharedPullerComponent? pullerComp))
|
||||||
|
{
|
||||||
|
var pulling = pullerComp.Pulling;
|
||||||
|
|
||||||
|
if (pulling != null &&
|
||||||
|
pulling.HasComponent<IMobStateComponent>() &&
|
||||||
|
pulling.TryGetComponent(out PhysicsComponent? pullingBody))
|
||||||
|
{
|
||||||
|
pullingBody.Predict = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Server-side should just be handled on its own so we'll just do this shizznit
|
// Server-side should just be handled on its own so we'll just do this shizznit
|
||||||
if (player.TryGetComponent(out IMobMoverComponent? mobMover))
|
if (player.TryGetComponent(out IMobMoverComponent? mobMover))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState;
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
@@ -49,7 +50,7 @@ namespace Content.Shared.Movement.EntitySystems
|
|||||||
|
|
||||||
if (owner != null && session != null)
|
if (owner != null && session != null)
|
||||||
{
|
{
|
||||||
foreach (var comp in owner.GetAllComponents<IRelayMoveInput>())
|
foreach (var comp in owner.GetAllComponents<IRelayMoveInput>().ToArray())
|
||||||
{
|
{
|
||||||
comp.MoveInputPressed(session);
|
comp.MoveInputPressed(session);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,6 +152,8 @@ namespace Content.Shared.Movement
|
|||||||
{
|
{
|
||||||
return body.BodyStatus == BodyStatus.OnGround &&
|
return body.BodyStatus == BodyStatus.OnGround &&
|
||||||
body.Owner.HasComponent<IMobStateComponent>() &&
|
body.Owner.HasComponent<IMobStateComponent>() &&
|
||||||
|
// If we're being pulled then don't mess with our velocity.
|
||||||
|
(!body.Owner.TryGetComponent(out SharedPullableComponent? pullable) || !pullable.BeingPulled) &&
|
||||||
_blocker.CanMove(body.Owner);
|
_blocker.CanMove(body.Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user