Remove IContainer and move functions to the container system. (#19834)

This commit is contained in:
Leon Friedrich
2023-09-10 14:16:37 +12:00
committed by GitHub
parent 2d71eec6f9
commit b45e53603d
19 changed files with 54 additions and 48 deletions

View File

@@ -120,7 +120,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
/// <summary>
/// Makes an event horizon consume a given entity.
/// </summary>
public void ConsumeEntity(EntityUid hungry, EntityUid morsel, EventHorizonComponent eventHorizon, IContainer? outerContainer = null)
public void ConsumeEntity(EntityUid hungry, EntityUid morsel, EventHorizonComponent eventHorizon, BaseContainer? outerContainer = null)
{
if (!EntityManager.IsQueuedForDeletion(morsel) // I saw it log twice a few times for some reason?
&& (HasComp<MindContainerComponent>(morsel)
@@ -140,7 +140,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
/// <summary>
/// Makes an event horizon attempt to consume a given entity.
/// </summary>
public bool AttemptConsumeEntity(EntityUid hungry, EntityUid morsel, EventHorizonComponent eventHorizon, IContainer? outerContainer = null)
public bool AttemptConsumeEntity(EntityUid hungry, EntityUid morsel, EventHorizonComponent eventHorizon, BaseContainer? outerContainer = null)
{
if (!CanConsumeEntity(hungry, morsel, eventHorizon))
return false;
@@ -192,7 +192,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
/// Excludes the event horizon itself.
/// All immune entities within the container will be dumped to a given container or the map/grid if that is impossible.
/// </summary>
public void ConsumeEntitiesInContainer(EntityUid hungry, IContainer container, EventHorizonComponent eventHorizon, IContainer? outerContainer = null)
public void ConsumeEntitiesInContainer(EntityUid hungry, BaseContainer container, EventHorizonComponent eventHorizon, BaseContainer? outerContainer = null)
{
// Removing the immune entities from the container needs to be deferred until after iteration or the iterator raises an error.
List<EntityUid> immune = new();

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Singularity.Events;
/// </summary>
[ByRefEvent]
public readonly record struct EntityConsumedByEventHorizonEvent
(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon, IContainer? container)
(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon, BaseContainer? container)
{
/// <summary>
/// The entity being consumed by the event horizon.
@@ -29,5 +29,5 @@ public readonly record struct EntityConsumedByEventHorizonEvent
/// 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 = container;
public readonly BaseContainer? Container = container;
}

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Singularity.Events;
/// </summary>
[ByRefEvent]
public readonly record struct EventHorizonConsumedEntityEvent
(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon, IContainer? container)
(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon, BaseContainer? container)
{
/// <summary>
/// The entity being consumed by the event horizon.
@@ -29,5 +29,5 @@ public readonly record struct EventHorizonConsumedEntityEvent
/// 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 = container;
public readonly BaseContainer? Container = container;
}