Fix errors

This commit is contained in:
DrSmugleaf
2021-12-05 21:02:04 +01:00
parent 2a3b7d809d
commit ab9d0cc6d8
94 changed files with 568 additions and 591 deletions

View File

@@ -44,8 +44,7 @@ namespace Content.Client.Physics.Controllers
// If we're being pulled then we won't predict anything and will receive server lerps so it looks way smoother.
if (EntityManager.TryGetComponent(player, out SharedPullableComponent? pullableComp))
{
var puller = pullableComp.Puller;
if (puller != default && EntityManager.TryGetComponent<PhysicsComponent?>(puller, out var pullerBody))
if (pullableComp.Puller is {Valid: true} puller && EntityManager.TryGetComponent<PhysicsComponent?>(puller, out var pullerBody))
{
pullerBody.Predict = false;
body.Predict = false;
@@ -55,9 +54,7 @@ namespace Content.Client.Physics.Controllers
// If we're pulling a mob then make sure that isn't predicted so it doesn't fuck our velocity up.
if (EntityManager.TryGetComponent(player, out SharedPullerComponent? pullerComp))
{
var pulling = pullerComp.Pulling;
if (pulling != default &&
if (pullerComp.Pulling is {Valid: true} pulling &&
EntityManager.HasComponent<MobStateComponent>(pulling) &&
EntityManager.TryGetComponent(pulling, out PhysicsComponent? pullingBody))
{