Fixes singularity collision and consume range (#13424)

Co-authored-by: keronshb <keronshb@live.com>
This commit is contained in:
TemporalOroboros
2023-07-19 01:01:27 -07:00
committed by GitHub
parent afef518fc5
commit 6313164368
13 changed files with 290 additions and 277 deletions

View File

@@ -6,28 +6,28 @@ namespace Content.Server.Singularity.Events;
/// <summary>
/// Event raised on the event horizon entity whenever an event horizon consumes an entity.
/// </summary>
public sealed class EntityConsumedByEventHorizonEvent : EntityEventArgs
[ByRefEvent]
public readonly record struct EntityConsumedByEventHorizonEvent
(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon, IContainer? container)
{
/// <summary>
/// The entity being consumed by the event horizon.
/// </summary>
public readonly EntityUid Entity;
public readonly EntityUid Entity = entity;
/// <summary>
/// The uid of the event horizon consuming the entity.
/// </summary>
public readonly EntityUid EventHorizonUid = eventHorizonUid;
/// <summary>
/// The event horizon consuming the entity.
/// </summary>
public readonly EventHorizonComponent EventHorizon;
public readonly EventHorizonComponent EventHorizon = eventHorizon;
/// <summary>
/// The innermost container of the entity being consumed by the event horizon that is not also in the process of being consumed by the event horizon.
/// Used to correctly dump out the contents containers that are consumed by the event horizon.
/// </summary>
public readonly IContainer? Container;
public EntityConsumedByEventHorizonEvent(EntityUid entity, EventHorizonComponent eventHorizon, IContainer? container = null)
{
Entity = entity;
EventHorizon = eventHorizon;
Container = container;
}
public readonly IContainer? Container = container;
}

View File

@@ -6,21 +6,27 @@ namespace Content.Server.Singularity.Events;
/// Event raised on the target entity whenever an event horizon attempts to consume an entity.
/// Can be cancelled to prevent the target entity from being consumed.
/// </summary>
public sealed class EventHorizonAttemptConsumeEntityEvent : CancellableEntityEventArgs
[ByRefEvent]
public record struct EventHorizonAttemptConsumeEntityEvent
(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon)
{
/// <summary>
/// The entity that the event horizon is attempting to consume.
/// </summary>
public readonly EntityUid Entity;
public readonly EntityUid Entity = entity;
/// <summary>
/// The uid of the event horizon consuming the entity.
/// </summary>
public readonly EntityUid EventHorizonUid = eventHorizonUid;
/// <summary>
/// The event horizon consuming the target entity.
/// </summary>
public readonly EventHorizonComponent EventHorizon;
public readonly EventHorizonComponent EventHorizon = eventHorizon;
public EventHorizonAttemptConsumeEntityEvent(EntityUid entity, EventHorizonComponent eventHorizon)
{
Entity = entity;
EventHorizon = eventHorizon;
}
/// <summary>
/// Whether the event horizon has been prevented from consuming the target entity.
/// </summary>
public bool Cancelled = false;
}

View File

@@ -4,30 +4,30 @@ using Robust.Shared.Containers;
namespace Content.Server.Singularity.Events;
/// <summary>
/// Event raised on the event horizon entity whenever an event horizon consumes an entity.
/// Event raised on the entity being consumed whenever an event horizon consumes an entity.
/// </summary>
public sealed class EventHorizonConsumedEntityEvent : EntityEventArgs
[ByRefEvent]
public readonly record struct EventHorizonConsumedEntityEvent
(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon, IContainer? container)
{
/// <summary>
/// The entity being consumed by the event horizon.
/// </summary>
public readonly EntityUid Entity;
public readonly EntityUid Entity = entity;
/// <summary>
/// The uid of the event horizon consuming the entity.
/// </summary>
public readonly EntityUid EventHorizonUid = eventHorizonUid;
/// <summary>
/// The event horizon consuming the target entity.
/// </summary>
public readonly EventHorizonComponent EventHorizon;
public readonly EventHorizonComponent EventHorizon = eventHorizon;
/// <summary>
/// The innermost container of the entity being consumed by the event horizon that is not also in the process of being consumed by the event horizon.
/// Used to correctly dump out the contents containers that are consumed by the event horizon.
/// </summary>
public readonly IContainer? Container;
public EventHorizonConsumedEntityEvent(EntityUid entity, EventHorizonComponent eventHorizon, IContainer? container = null)
{
Entity = entity;
EventHorizon = eventHorizon;
Container = container;
}
public readonly IContainer? Container = container;
}

View File

@@ -6,8 +6,10 @@ namespace Content.Shared.Singularity.EntitySystems;
/// <summary>
/// An event queued when an event horizon is contained (put into a container).
/// Exists to delay the event horizon eating its way out of the container until events relating to the insertion have been processed.
/// Needs to be a class because ref structs can't be put into the queue.
/// </summary>
public sealed class EventHorizonContainedEvent : EntityEventArgs {
public sealed class EventHorizonContainedEvent : EntityEventArgs
{
/// <summary>
/// The uid of the event horizon that has been contained.
/// </summary>
@@ -23,7 +25,8 @@ public sealed class EventHorizonContainedEvent : EntityEventArgs {
/// </summary>
public readonly EntGotInsertedIntoContainerMessage Args;
public EventHorizonContainedEvent(EntityUid entity, EventHorizonComponent eventHorizon, EntGotInsertedIntoContainerMessage args) {
public EventHorizonContainedEvent(EntityUid entity, EventHorizonComponent eventHorizon, EntGotInsertedIntoContainerMessage args)
{
Entity = entity;
EventHorizon = eventHorizon;
Args = args;

View File

@@ -8,28 +8,33 @@ namespace Content.Server.Singularity.Events;
/// <summary>
/// Event raised on the event horizon entity whenever an event horizon consumes an entity.
/// </summary>
public sealed class TilesConsumedByEventHorizonEvent : EntityEventArgs
[ByRefEvent]
public readonly record struct TilesConsumedByEventHorizonEvent
(IReadOnlyList<(Vector2i, Tile)> tiles, EntityUid mapGridUid, MapGridComponent mapGrid, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon)
{
/// <summary>
/// The tiles that the event horizon is consuming.
/// Ripped directly from the relevant proc so the second element of each element will be what the tiles are going to be after the grid is updated; usually <see cref="Tile.Empty"/>.
/// </summary>
public readonly IReadOnlyList<(Vector2i, Tile)> Tiles;
public readonly IReadOnlyList<(Vector2i, Tile)> Tiles = tiles;
/// <summary>
/// The uid of the map grid the event horizon is consuming part of.
/// </summary>
public readonly EntityUid MapGridUid = mapGridUid;
/// <summary>
/// The mapgrid that the event horizon is consuming tiles of.
/// </summary>
public readonly MapGridComponent MapGrid;
public readonly MapGridComponent MapGrid = mapGrid;
/// <summary>
/// The uid of the event horizon consuming the entity.
/// </summary>
public readonly EntityUid EventHorizonUid = eventHorizonUid;
/// <summary>
/// The event horizon consuming the tiles.
/// </summary>
public readonly EventHorizonComponent EventHorizon;
public TilesConsumedByEventHorizonEvent(IReadOnlyList<(Vector2i, Tile)> tiles, MapGridComponent mapGrid, EventHorizonComponent eventHorizon)
{
Tiles = tiles;
MapGrid = mapGrid;
EventHorizon = eventHorizon;
}
public readonly EventHorizonComponent EventHorizon = eventHorizon;
}