Pulling rework (#20906)

* 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
This commit is contained in:
metalgearsloth
2024-02-03 14:36:09 +11:00
committed by GitHub
parent 79e3a6630d
commit 0d8254b2a2
53 changed files with 764 additions and 1359 deletions

View File

@@ -0,0 +1,13 @@
using Robust.Shared.Physics.Components;
namespace Content.Shared.Movement.Pulling.Events;
/// <summary>
/// Raised directed on puller and pullable to determine if it can be pulled.
/// </summary>
public sealed class PullAttemptEvent : PullMessage
{
public PullAttemptEvent(EntityUid pullerUid, EntityUid pullableUid) : base(pullerUid, pullableUid) { }
public bool Cancelled { get; set; }
}

View File

@@ -0,0 +1,10 @@
namespace Content.Shared.Pulling.Events;
/// <summary>
/// Raised when a request is made to stop pulling an entity.
/// </summary>
public record struct AttemptStopPullingEvent(EntityUid? User = null)
{
public readonly EntityUid? User = User;
public bool Cancelled;
}

View File

@@ -0,0 +1,17 @@
namespace Content.Shared.Pulling.Events
{
/// <summary>
/// Directed event raised on the pulled to see if it can be pulled.
/// </summary>
public sealed class BeingPulledAttemptEvent : CancellableEntityEventArgs
{
public BeingPulledAttemptEvent(EntityUid puller, EntityUid pulled)
{
Puller = puller;
Pulled = pulled;
}
public EntityUid Puller { get; }
public EntityUid Pulled { get; }
}
}

View File

@@ -0,0 +1,13 @@
namespace Content.Shared.Movement.Pulling.Events;
public abstract class PullMessage : EntityEventArgs
{
public readonly EntityUid PullerUid;
public readonly EntityUid PulledUid;
protected PullMessage(EntityUid pullerUid, EntityUid pulledUid)
{
PullerUid = pullerUid;
PulledUid = pulledUid;
}
}

View File

@@ -0,0 +1,9 @@
namespace Content.Shared.Movement.Pulling.Events;
public sealed class PullStartedMessage : PullMessage
{
public PullStartedMessage(EntityUid pullerUid, EntityUid pullableUid) :
base(pullerUid, pullableUid)
{
}
}

View File

@@ -0,0 +1,13 @@
using Robust.Shared.Physics.Components;
namespace Content.Shared.Movement.Pulling.Events;
/// <summary>
/// Raised directed on both puller and pullable.
/// </summary>
public sealed class PullStoppedMessage : PullMessage
{
public PullStoppedMessage(EntityUid pullerUid, EntityUid pulledUid) : base(pullerUid, pulledUid)
{
}
}

View File

@@ -0,0 +1,17 @@
namespace Content.Shared.Pulling.Events
{
/// <summary>
/// Directed event raised on the puller to see if it can start pulling something.
/// </summary>
public sealed class StartPullAttemptEvent : CancellableEntityEventArgs
{
public StartPullAttemptEvent(EntityUid puller, EntityUid pulled)
{
Puller = puller;
Pulled = pulled;
}
public EntityUid Puller { get; }
public EntityUid Pulled { get; }
}
}