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,8 +5,11 @@ using Content.Server.GameObjects.Components.Buckle;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Movement;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Pulling;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Players;
using Robust.Shared.ViewVariables;
@@ -25,7 +28,7 @@ namespace Content.Server.GameObjects.Components.Mobs
return new StatusEffectComponentState(_statusEffects);
}
public void ChangeStatusEffectIcon(StatusEffect effect, string icon)
public override void ChangeStatusEffectIcon(StatusEffect effect, string icon)
{
if (_statusEffects.TryGetValue(effect, out var value) && value.Icon == icon)
{
@@ -60,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Mobs
Dirty();
}
public void RemoveStatusEffect(StatusEffect effect)
public override void RemoveStatusEffect(StatusEffect effect)
{
if (!_statusEffects.Remove(effect))
{
@@ -106,19 +109,19 @@ namespace Content.Server.GameObjects.Components.Mobs
controller.RemoveController();
break;
case StatusEffect.Pulling:
if (!player.TryGetComponent(out HandsComponent hands))
break;
EntitySystem
.Get<SharedPullingSystem>()
.GetPulled(player)?
.GetComponentOrNull<SharedPullableComponent>()?
.TryStopPull();
hands.StopPull();
break;
case StatusEffect.Fire:
if (!player.TryGetComponent(out FlammableComponent flammable))
break;
flammable.Resist();
break;
default:
player.PopupMessage(msg.Effect.ToString());
break;