Add client pulling prediction (#2041)

* WIP changes

* Merge conflict fixes

* Bring pull controlelr to current year

* Sync and predict PullController on the client

* Clean imports

* Slow down pullers and make pulling tighter

* Stop pulls on pullable or puller component removals

* Make pulling not occur when moving towards the pulled entity
This commit is contained in:
DrSmugleaf
2020-10-16 20:35:09 +02:00
committed by GitHub
parent 0345fbbd22
commit b1fe4bad01
24 changed files with 734 additions and 341 deletions

View File

@@ -5,6 +5,7 @@ using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Movement;
using Content.Server.GameObjects.Components.Pulling;
using Content.Server.GameObjects.Components.Timing;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.GameObjects.Components.Inventory;
@@ -273,12 +274,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
return false;
}
if (!pulledObject.TryGetComponent<PullableComponent>(out var pull))
{
return false;
}
if (!player.TryGetComponent<HandsComponent>(out var hands))
if (!pulledObject.TryGetComponent(out PullableComponent pull))
{
return false;
}
@@ -289,24 +285,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
return false;
}
if (!pull.Owner.TryGetComponent(out IPhysicsComponent physics) ||
physics.Anchored)
{
return false;
}
var controller = physics.EnsureController<PullController>();
if (controller.GettingPulled)
{
hands.StopPull();
}
else
{
hands.StartPull(pull);
}
return false;
return pull.TogglePull(player);
}
private void UserInteraction(IEntity player, EntityCoordinates coordinates, EntityUid clickedUid)