Pulling rework v2 (#24936)
* Pulling rework Fixing up the FOUR systems managing pulling, all the shitcode, and also making it nicer ingame. * More pulling cleanup * stats * More cleanup * First draft * More pulling * weh * Fix puller * Pulling working * Fix merge * Dunked * Self-merge time * Fix hotkey * Fix container changes * oop * Fix multi-pulling * Move alerts cleanup. * pulling fixes
This commit is contained in:
@@ -4,6 +4,7 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client.Alerts;
|
||||
|
||||
@@ -12,6 +13,7 @@ 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!;
|
||||
|
||||
@@ -49,24 +51,23 @@ public sealed class ClientAlertsSystem : AlertsSystem
|
||||
|
||||
protected override void AfterShowAlert(Entity<AlertsComponent> alerts)
|
||||
{
|
||||
if (_playerManager.LocalEntity != alerts.Owner)
|
||||
return;
|
||||
|
||||
SyncAlerts?.Invoke(this, alerts.Comp.Alerts);
|
||||
UpdateHud(alerts);
|
||||
}
|
||||
|
||||
protected override void AfterClearAlert(Entity<AlertsComponent> alertsComponent)
|
||||
protected override void AfterClearAlert(Entity<AlertsComponent> alerts)
|
||||
{
|
||||
if (_playerManager.LocalEntity != alertsComponent.Owner)
|
||||
return;
|
||||
|
||||
SyncAlerts?.Invoke(this, alertsComponent.Comp.Alerts);
|
||||
UpdateHud(alerts);
|
||||
}
|
||||
|
||||
private void ClientAlertsHandleState(EntityUid uid, AlertsComponent component, ref AfterAutoHandleStateEvent args)
|
||||
private void ClientAlertsHandleState(Entity<AlertsComponent> alerts, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (_playerManager.LocalEntity == uid)
|
||||
SyncAlerts?.Invoke(this, component.Alerts);
|
||||
UpdateHud(alerts);
|
||||
}
|
||||
|
||||
private void UpdateHud(Entity<AlertsComponent> entity)
|
||||
{
|
||||
if (_playerManager.LocalEntity == entity.Owner)
|
||||
SyncAlerts?.Invoke(this, entity.Comp.Alerts);
|
||||
}
|
||||
|
||||
private void OnPlayerAttached(EntityUid uid, AlertsComponent component, LocalPlayerAttachedEvent args)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Pulling.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Physics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Physics.Components;
|
||||
@@ -24,7 +25,7 @@ namespace Content.Client.Physics.Controllers
|
||||
|
||||
SubscribeLocalEvent<InputMoverComponent, UpdateIsPredictedEvent>(OnUpdatePredicted);
|
||||
SubscribeLocalEvent<MovementRelayTargetComponent, UpdateIsPredictedEvent>(OnUpdateRelayTargetPredicted);
|
||||
SubscribeLocalEvent<SharedPullableComponent, UpdateIsPredictedEvent>(OnUpdatePullablePredicted);
|
||||
SubscribeLocalEvent<PullableComponent, UpdateIsPredictedEvent>(OnUpdatePullablePredicted);
|
||||
}
|
||||
|
||||
private void OnUpdatePredicted(EntityUid uid, InputMoverComponent component, ref UpdateIsPredictedEvent args)
|
||||
@@ -40,7 +41,7 @@ namespace Content.Client.Physics.Controllers
|
||||
args.IsPredicted = true;
|
||||
}
|
||||
|
||||
private void OnUpdatePullablePredicted(EntityUid uid, SharedPullableComponent component, ref UpdateIsPredictedEvent args)
|
||||
private void OnUpdatePullablePredicted(EntityUid uid, PullableComponent 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.
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.Physics.Pull;
|
||||
using Content.Shared.Movement.Pulling.Events;
|
||||
using Content.Shared.Throwing;
|
||||
|
||||
namespace Content.Client.Replay.Spectator;
|
||||
|
||||
@@ -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))
|
||||
if (!TryComp<SpriteComponent>(uid, out var sprite) || !component.Animate)
|
||||
return;
|
||||
|
||||
var animationPlayer = EnsureComp<AnimationPlayerComponent>(uid);
|
||||
|
||||
Reference in New Issue
Block a user