From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Wed, 20 Dec 2023 00:57:29 +0000 (-0500) Subject: Stop AtmosphereSystem from logging errors if an atmosphere gets deleted. (#22761) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=b1e12d03f1d049276e80e6110e1ebcf6dbf55f67;p=space-station-14.git Stop AtmosphereSystem from logging errors if an atmosphere gets deleted. (#22761) Stop AtmosphereSystem from logging errors if a atmosphere gets deleted. --- diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.GridAtmosphere.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.GridAtmosphere.cs index 3eb38296f6..5891d64d4d 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.GridAtmosphere.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.GridAtmosphere.cs @@ -14,6 +14,7 @@ public sealed partial class AtmosphereSystem private void InitializeGridAtmosphere() { SubscribeLocalEvent(OnGridAtmosphereInit); + SubscribeLocalEvent(OnAtmosphereRemove); SubscribeLocalEvent(OnGridSplit); #region Atmos API Subscriptions @@ -42,6 +43,19 @@ public sealed partial class AtmosphereSystem #endregion } + private void OnAtmosphereRemove(EntityUid uid, GridAtmosphereComponent component, ComponentRemove args) + { + for (var i = 0; i < _currentRunAtmosphere.Count; i++) + { + if (_currentRunAtmosphere[i].Owner != uid) + continue; + + _currentRunAtmosphere.RemoveAt(i); + if (_currentRunAtmosphereIndex >= i) + _currentRunAtmosphereIndex--; + } + } + private void OnGridAtmosphereInit(EntityUid uid, GridAtmosphereComponent gridAtmosphere, ComponentInit args) { base.Initialize();