Add additional container assert (#3397)

This commit is contained in:
Leon Friedrich
2022-10-29 12:53:29 +13:00
committed by GitHub
parent 3fba59eb6c
commit 94aeb309b2
3 changed files with 4 additions and 12 deletions

View File

@@ -207,6 +207,7 @@ namespace Robust.Shared.Containers
IoCManager.Resolve(ref entMan);
DebugTools.Assert(entMan.EntityExists(toremove));
DebugTools.Assert(xform == null || xform.Owner == toremove);
DebugTools.Assert(entMan.GetComponent<MetaDataComponent>(Owner).EntityLifeStage < EntityLifeStage.Terminating);
if (!CanRemove(toremove, entMan)) return false;
InternalRemove(toremove, entMan, meta);

View File

@@ -333,11 +333,8 @@ namespace Robust.Shared.GameObjects
{
var transform = xformQuery.GetComponent(metadata.Owner);
metadata.EntityLifeStage = EntityLifeStage.Terminating;
var ev = new EntityTerminatingEvent(metadata.Owner);
// TODO: consider making this a meta-data flag?
// veeeery few entities make use of this event.
EventBus.RaiseLocalEvent(metadata.Owner, ref ev, false);
var ev = new EntityTerminatingEvent();
EventBus.RaiseLocalEvent(metadata.Owner, ref ev);
foreach (var child in transform._children)
{

View File

@@ -4,13 +4,7 @@ namespace Robust.Shared.GameObjects
/// The children of this entity are about to be deleted.
/// </summary>
[ByRefEvent]
public struct EntityTerminatingEvent
public readonly struct EntityTerminatingEvent
{
public EntityUid Owner;
public EntityTerminatingEvent(EntityUid uid)
{
Owner = uid;
}
}
}