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

@@ -16,7 +16,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
@@ -47,8 +46,6 @@ namespace Content.Server.GameObjects.EntitySystems
.Bind(ContentKeyFunctions.ThrowItemInHand, new PointerInputCmdHandler(HandleThrowItem))
.Bind(ContentKeyFunctions.SmartEquipBackpack, InputCmdHandler.FromDelegate(HandleSmartEquipBackpack))
.Bind(ContentKeyFunctions.SmartEquipBelt, InputCmdHandler.FromDelegate(HandleSmartEquipBelt))
.Bind(ContentKeyFunctions.MovePulledObject, new PointerInputCmdHandler(HandleMovePulledObject))
.Bind(ContentKeyFunctions.ReleasePulledObject, InputCmdHandler.FromDelegate(HandleReleasePulledObject))
.Register<HandsSystem>();
}
@@ -229,29 +226,5 @@ namespace Content.Server.GameObjects.EntitySystems
}
}
}
private bool HandleMovePulledObject(ICommonSession session, EntityCoordinates coords, EntityUid uid)
{
var playerEntity = session.AttachedEntity;
if (playerEntity == null ||
!playerEntity.TryGetComponent<HandsComponent>(out var hands))
{
return false;
}
hands.MovePulledObject(playerEntity.Transform.Coordinates, coords);
return false;
}
private static void HandleReleasePulledObject(ICommonSession session)
{
if (!TryGetAttachedComponent(session as IPlayerSession, out HandsComponent handsComp))
return;
handsComp.StopPull();
}
}
}