From 2d2bfecaf649df8d5743787107b428af0f1ca8d7 Mon Sep 17 00:00:00 2001 From: sleepyyapril Date: Mon, 30 Dec 2024 19:33:38 -0400 Subject: [PATCH] Add all ComponentStart features to OnMapInit function --- Content.Server/Ghost/GhostSystem.cs | 34 +++++++++++++---------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 2be39f79837..43b7b6f5f82 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -55,7 +55,6 @@ public override void Initialize() _ghostQuery = GetEntityQuery(); _physicsQuery = GetEntityQuery(); - SubscribeLocalEvent(OnGhostStartup); SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnGhostShutdown); @@ -147,24 +146,6 @@ private void OnRelayMoveInput(EntityUid uid, GhostOnMoveComponent component, ref _ticker.OnGhostAttempt(mindId, component.CanReturn, mind: mind); } - private void OnGhostStartup(EntityUid uid, GhostComponent component, ComponentStartup args) - { - // Allow this entity to be seen by other ghosts. - var visibility = EnsureComp(uid); - - if (_ticker.RunLevel != GameRunLevel.PostRound) - { - _visibilitySystem.AddLayer((uid, visibility), (int) VisibilityFlags.Ghost, false); - _visibilitySystem.RemoveLayer((uid, visibility), (int) VisibilityFlags.Normal, false); - _visibilitySystem.RefreshVisibility(uid, visibilityComponent: visibility); - } - - SetCanSeeGhosts(uid, true); - - var time = _gameTiming.CurTime; - component.TimeOfDeath = time; - } - private void OnGhostShutdown(EntityUid uid, GhostComponent component, ComponentShutdown args) { // Perf: If the entity is deleting itself, no reason to change these back. @@ -197,6 +178,21 @@ private void SetCanSeeGhosts(EntityUid uid, bool canSee, EyeComponent? eyeCompon private void OnMapInit(EntityUid uid, GhostComponent component, MapInitEvent args) { + // Allow this entity to be seen by other ghosts. + var visibility = EnsureComp(uid); + + if (_ticker.RunLevel != GameRunLevel.PostRound) + { + _visibilitySystem.AddLayer((uid, visibility), (int) VisibilityFlags.Ghost, false); + _visibilitySystem.RemoveLayer((uid, visibility), (int) VisibilityFlags.Normal, false); + _visibilitySystem.RefreshVisibility(uid, visibilityComponent: visibility); + } + + SetCanSeeGhosts(uid, true); + + var time = _gameTiming.CurTime; + component.TimeOfDeath = time; + _actions.AddAction(uid, ref component.BooActionEntity, component.BooAction); _actions.AddAction(uid, ref component.ToggleGhostHearingActionEntity, component.ToggleGhostHearingAction); _actions.AddAction(uid, ref component.ToggleLightingActionEntity, component.ToggleLightingAction);