Emergency revert for pulling (#24923)

Revert "Pulling rework (#20906)"

This reverts commit 0d8254b2a2.
This commit is contained in:
Jezithyr
2024-02-03 10:32:30 -08:00
committed by GitHub
parent 914bab19e8
commit c15b0691ec
53 changed files with 1359 additions and 764 deletions

View File

@@ -4,7 +4,6 @@ using JetBrains.Annotations;
using Robust.Client.Player;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Client.Alerts;
@@ -13,7 +12,6 @@ public sealed class ClientAlertsSystem : AlertsSystem
{
public AlertOrderPrototype? AlertOrder { get; set; }
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
@@ -42,7 +40,7 @@ public sealed class ClientAlertsSystem : AlertsSystem
{
get
{
var ent = _playerManager.LocalEntity;
var ent = _playerManager.LocalPlayer?.ControlledEntity;
return ent is not null
? GetActiveAlerts(ent.Value)
: null;
@@ -51,28 +49,29 @@ public sealed class ClientAlertsSystem : AlertsSystem
protected override void AfterShowAlert(Entity<AlertsComponent> alerts)
{
UpdateHud(alerts);
if (_playerManager.LocalPlayer?.ControlledEntity != alerts.Owner)
return;
SyncAlerts?.Invoke(this, alerts.Comp.Alerts);
}
protected override void AfterClearAlert(Entity<AlertsComponent> alerts)
protected override void AfterClearAlert(Entity<AlertsComponent> alertsComponent)
{
UpdateHud(alerts);
if (_playerManager.LocalPlayer?.ControlledEntity != alertsComponent.Owner)
return;
SyncAlerts?.Invoke(this, alertsComponent.Comp.Alerts);
}
private void ClientAlertsHandleState(Entity<AlertsComponent> alerts, ref AfterAutoHandleStateEvent args)
private void ClientAlertsHandleState(EntityUid uid, AlertsComponent component, ref AfterAutoHandleStateEvent args)
{
UpdateHud(alerts);
}
private void UpdateHud(Entity<AlertsComponent> entity)
{
if (_playerManager.LocalEntity == entity.Owner)
SyncAlerts?.Invoke(this, entity.Comp.Alerts);
if (_playerManager.LocalPlayer?.ControlledEntity == uid)
SyncAlerts?.Invoke(this, component.Alerts);
}
private void OnPlayerAttached(EntityUid uid, AlertsComponent component, LocalPlayerAttachedEvent args)
{
if (_playerManager.LocalEntity != uid)
if (_playerManager.LocalPlayer?.ControlledEntity != uid)
return;
SyncAlerts?.Invoke(this, component.Alerts);
@@ -82,7 +81,7 @@ public sealed class ClientAlertsSystem : AlertsSystem
{
base.HandleComponentShutdown(uid, component, args);
if (_playerManager.LocalEntity != uid)
if (_playerManager.LocalPlayer?.ControlledEntity != uid)
return;
ClearAlerts?.Invoke(this, EventArgs.Empty);

View File

@@ -1,7 +1,6 @@
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Systems;
using Robust.Client.GameObjects;
using Content.Shared.Pulling.Components;
using Robust.Client.Physics;
using Robust.Client.Player;
using Robust.Shared.Physics.Components;
@@ -25,7 +24,7 @@ namespace Content.Client.Physics.Controllers
SubscribeLocalEvent<InputMoverComponent, UpdateIsPredictedEvent>(OnUpdatePredicted);
SubscribeLocalEvent<MovementRelayTargetComponent, UpdateIsPredictedEvent>(OnUpdateRelayTargetPredicted);
SubscribeLocalEvent<PullableComponent, UpdateIsPredictedEvent>(OnUpdatePullablePredicted);
SubscribeLocalEvent<SharedPullableComponent, UpdateIsPredictedEvent>(OnUpdatePullablePredicted);
}
private void OnUpdatePredicted(EntityUid uid, InputMoverComponent component, ref UpdateIsPredictedEvent args)
@@ -41,7 +40,7 @@ namespace Content.Client.Physics.Controllers
args.IsPredicted = true;
}
private void OnUpdatePullablePredicted(EntityUid uid, PullableComponent component, ref UpdateIsPredictedEvent args)
private void OnUpdatePullablePredicted(EntityUid uid, SharedPullableComponent component, ref UpdateIsPredictedEvent args)
{
// Enable prediction if an entity is being pulled by the player.
// Disable prediction if an entity is being pulled by some non-player entity.

View File

@@ -0,0 +1,21 @@
using Content.Shared.Pulling;
using Content.Shared.Pulling.Components;
using JetBrains.Annotations;
using Robust.Client.Physics;
namespace Content.Client.Pulling
{
[UsedImplicitly]
public sealed class PullingSystem : SharedPullingSystem
{
public override void Initialize()
{
base.Initialize();
UpdatesAfter.Add(typeof(PhysicsSystem));
SubscribeLocalEvent<SharedPullableComponent, PullableMoveMessage>(OnPullableMove);
SubscribeLocalEvent<SharedPullableComponent, PullableStopMovingMessage>(OnPullableStopMove);
}
}
}

View File

@@ -3,7 +3,7 @@ using Content.Shared.Interaction.Events;
using Content.Shared.Inventory.Events;
using Content.Shared.Item;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Pulling.Events;
using Content.Shared.Physics.Pull;
using Content.Shared.Throwing;
namespace Content.Client.Replay.Spectator;

View File

@@ -24,7 +24,7 @@ public sealed class ThrownItemVisualizerSystem : EntitySystem
private void OnAutoHandleState(EntityUid uid, ThrownItemComponent component, ref AfterAutoHandleStateEvent args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite) || !component.Animate)
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
var animationPlayer = EnsureComp<AnimationPlayerComponent>(uid);