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:
@@ -1,38 +1,15 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Body;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Power;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.Kitchen;
|
||||
using Content.Shared.Prototypes.Kitchen;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Server.GameObjects.Components.UserInterface;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timers;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Kitchen
|
||||
{
|
||||
@@ -49,11 +26,9 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
var victim = eventArgs.User.GetComponent<HandsComponent>().PulledObject?.Owner;
|
||||
SpriteComponent? sprite;
|
||||
|
||||
var sprite = Owner.GetComponent<SpriteComponent>();
|
||||
|
||||
if (victim == null)
|
||||
if (!EntitySystem.Get<SharedPullingSystem>().TryGetPulled(eventArgs.User, out var victim))
|
||||
{
|
||||
if (_meatParts == 0)
|
||||
{
|
||||
@@ -72,12 +47,18 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite.LayerSetState(0, "spike");
|
||||
if (Owner.TryGetComponent(out sprite))
|
||||
{
|
||||
sprite.LayerSetState(0, "spike");
|
||||
}
|
||||
|
||||
eventArgs.User.PopupMessage(_meatSource0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (_meatParts > 0)
|
||||
|
||||
if (_meatParts > 0)
|
||||
{
|
||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("The spike already has something on it, finish collecting its meat first!"));
|
||||
return;
|
||||
@@ -94,7 +75,10 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
_meatSource1p = Loc.GetString("You remove some meat from {0:theName}.", victim);
|
||||
_meatSource0 = Loc.GetString("You remove the last piece of meat from {0:theName}!", victim);
|
||||
|
||||
sprite.LayerSetState(0, "spikebloody");
|
||||
if (Owner.TryGetComponent(out sprite))
|
||||
{
|
||||
sprite.LayerSetState(0, "spikebloody");
|
||||
}
|
||||
|
||||
Owner.PopupMessageEveryone(Loc.GetString("{0:theName} has forced {1:theName} onto the spike, killing them instantly!", eventArgs.User, victim));
|
||||
victim.Delete();
|
||||
|
||||
Reference in New Issue
Block a user