From e2771222374362c69d96709d52740ddd6d8b3a95 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:22:08 +1100 Subject: [PATCH] Cleanup matches on shutdown (#5724) --- Content.Server/Light/EntitySystems/MatchstickSystem.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Content.Server/Light/EntitySystems/MatchstickSystem.cs b/Content.Server/Light/EntitySystems/MatchstickSystem.cs index 67bf4dc3ad..e8b898579c 100644 --- a/Content.Server/Light/EntitySystems/MatchstickSystem.cs +++ b/Content.Server/Light/EntitySystems/MatchstickSystem.cs @@ -24,6 +24,12 @@ namespace Content.Server.Light.EntitySystems base.Initialize(); SubscribeLocalEvent(OnInteractUsing); SubscribeLocalEvent(OnIsHotEvent); + SubscribeLocalEvent(OnShutdown); + } + + private void OnShutdown(EntityUid uid, MatchstickComponent component, ComponentShutdown args) + { + _litMatches.Remove(component); } public override void Update(float frameTime) @@ -31,7 +37,7 @@ namespace Content.Server.Light.EntitySystems base.Update(frameTime); foreach (var match in _litMatches) { - if (match.CurrentState != SmokableState.Lit) + if (match.CurrentState != SmokableState.Lit || match.Paused || match.Deleted) continue; _atmosphereSystem.HotspotExpose(EntityManager.GetComponent(match.Owner).Coordinates, 400, 50, true);