From 9b402acfa3c50355f514e885052cacd584ba9dc5 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Thu, 27 May 2021 11:11:56 +0200 Subject: [PATCH] Use component startup/shutdown in SubFloorHideSystem. --- .../EntitySystems/SubFloorHideSystem.cs | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Content.Shared/GameObjects/EntitySystems/SubFloorHideSystem.cs b/Content.Shared/GameObjects/EntitySystems/SubFloorHideSystem.cs index be25aeea2e..22682f901a 100644 --- a/Content.Shared/GameObjects/EntitySystems/SubFloorHideSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SubFloorHideSystem.cs @@ -53,10 +53,8 @@ namespace Content.Shared.GameObjects.EntitySystems _mapManager.GridChanged += MapManagerOnGridChanged; _mapManager.TileChanged += MapManagerOnTileChanged; - // TODO: Make this sane when EntityStarted becomes a directed event. - EntityManager.EntityStarted += OnEntityStarted; - - SubscribeLocalEvent(OnSubFloorTerminating); + SubscribeLocalEvent(OnSubFloorStarted); + SubscribeLocalEvent(OnSubFloorTerminating); SubscribeLocalEvent(OnSnapGridPositionChanged); } @@ -66,22 +64,14 @@ namespace Content.Shared.GameObjects.EntitySystems _mapManager.GridChanged -= MapManagerOnGridChanged; _mapManager.TileChanged -= MapManagerOnTileChanged; - - EntityManager.EntityStarted -= OnEntityStarted; - - UnsubscribeLocalEvent(OnSubFloorTerminating); - UnsubscribeLocalEvent(OnSnapGridPositionChanged); } - private void OnEntityStarted(object? sender, EntityUid uid) + private void OnSubFloorStarted(EntityUid uid, SubFloorHideComponent component, ComponentStartup _) { - if (ComponentManager.HasComponent(uid)) - { - UpdateEntity(uid); - } + UpdateEntity(uid); } - private void OnSubFloorTerminating(EntityUid uid, SubFloorHideComponent component, EntityTerminatingEvent args) + private void OnSubFloorTerminating(EntityUid uid, SubFloorHideComponent component, ComponentShutdown _) { UpdateEntity(uid); }