Use component startup/shutdown in SubFloorHideSystem.
This commit is contained in:
@@ -53,10 +53,8 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
_mapManager.GridChanged += MapManagerOnGridChanged;
|
_mapManager.GridChanged += MapManagerOnGridChanged;
|
||||||
_mapManager.TileChanged += MapManagerOnTileChanged;
|
_mapManager.TileChanged += MapManagerOnTileChanged;
|
||||||
|
|
||||||
// TODO: Make this sane when EntityStarted becomes a directed event.
|
SubscribeLocalEvent<SubFloorHideComponent, ComponentStartup>(OnSubFloorStarted);
|
||||||
EntityManager.EntityStarted += OnEntityStarted;
|
SubscribeLocalEvent<SubFloorHideComponent, ComponentShutdown>(OnSubFloorTerminating);
|
||||||
|
|
||||||
SubscribeLocalEvent<SubFloorHideComponent, EntityTerminatingEvent>(OnSubFloorTerminating);
|
|
||||||
SubscribeLocalEvent<SubFloorHideComponent, SnapGridPositionChangedEvent>(OnSnapGridPositionChanged);
|
SubscribeLocalEvent<SubFloorHideComponent, SnapGridPositionChangedEvent>(OnSnapGridPositionChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,22 +64,14 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
|
|
||||||
_mapManager.GridChanged -= MapManagerOnGridChanged;
|
_mapManager.GridChanged -= MapManagerOnGridChanged;
|
||||||
_mapManager.TileChanged -= MapManagerOnTileChanged;
|
_mapManager.TileChanged -= MapManagerOnTileChanged;
|
||||||
|
|
||||||
EntityManager.EntityStarted -= OnEntityStarted;
|
|
||||||
|
|
||||||
UnsubscribeLocalEvent<SubFloorHideComponent, EntityTerminatingEvent>(OnSubFloorTerminating);
|
|
||||||
UnsubscribeLocalEvent<SubFloorHideComponent, SnapGridPositionChangedEvent>(OnSnapGridPositionChanged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEntityStarted(object? sender, EntityUid uid)
|
private void OnSubFloorStarted(EntityUid uid, SubFloorHideComponent component, ComponentStartup _)
|
||||||
{
|
{
|
||||||
if (ComponentManager.HasComponent<SubFloorHideComponent>(uid))
|
UpdateEntity(uid);
|
||||||
{
|
|
||||||
UpdateEntity(uid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSubFloorTerminating(EntityUid uid, SubFloorHideComponent component, EntityTerminatingEvent args)
|
private void OnSubFloorTerminating(EntityUid uid, SubFloorHideComponent component, ComponentShutdown _)
|
||||||
{
|
{
|
||||||
UpdateEntity(uid);
|
UpdateEntity(uid);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user