mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Remove EntityInitializedMessage (#3657)
This commit is contained in:
@@ -35,7 +35,7 @@ END TEMPLATE-->
|
||||
|
||||
### Breaking changes
|
||||
|
||||
*None yet*
|
||||
* EntityInitializedMessage has been removed; the C# event invoked on EntityManager (EntityInitialized) should be used in its place.
|
||||
|
||||
### New features
|
||||
|
||||
|
||||
@@ -30,26 +30,32 @@ namespace Robust.Client.GameObjects
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<EntityInitializedMessage>(HandleEntityInitialized);
|
||||
EntityManager.EntityInitialized += HandleEntityInitialized;
|
||||
SubscribeLocalEvent<ContainerManagerComponent, ComponentHandleState>(HandleComponentState);
|
||||
|
||||
UpdatesBefore.Add(typeof(SpriteSystem));
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
{
|
||||
EntityManager.EntityInitialized -= HandleEntityInitialized;
|
||||
base.Shutdown();
|
||||
}
|
||||
|
||||
protected override void ValidateMissingEntity(EntityUid uid, IContainer cont, EntityUid missing)
|
||||
{
|
||||
DebugTools.Assert(ExpectedEntities.TryGetValue(missing, out var expectedContainer) && expectedContainer == cont && cont.ExpectedEntities.Contains(missing));
|
||||
}
|
||||
|
||||
private void HandleEntityInitialized(EntityInitializedMessage ev)
|
||||
private void HandleEntityInitialized(EntityUid uid)
|
||||
{
|
||||
if (!RemoveExpectedEntity(ev.Entity, out var container))
|
||||
if (!RemoveExpectedEntity(uid, out var container))
|
||||
return;
|
||||
|
||||
if (container.Deleted)
|
||||
return;
|
||||
|
||||
container.Insert(ev.Entity);
|
||||
container.Insert(uid);
|
||||
}
|
||||
|
||||
private void HandleComponentState(EntityUid uid, ContainerManagerComponent component, ref ComponentHandleState args)
|
||||
|
||||
@@ -160,7 +160,6 @@ namespace Robust.Shared.GameObjects
|
||||
#endif
|
||||
DebugTools.Assert(metadata.EntityLifeStage == EntityLifeStage.Initializing);
|
||||
metadata.EntityLifeStage = EntityLifeStage.Initialized;
|
||||
EventBus.RaiseEvent(EventSource.Local, new EntityInitializedMessage(uid));
|
||||
}
|
||||
|
||||
public void StartComponents(EntityUid uid)
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace Robust.Shared.GameObjects
|
||||
{
|
||||
public readonly struct EntityInitializedMessage
|
||||
{
|
||||
public EntityUid Entity { get; }
|
||||
|
||||
public EntityInitializedMessage(EntityUid entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user