]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Try fix random explosion test failures (#23158)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Fri, 29 Dec 2023 03:23:41 +0000 (22:23 -0500)
committerGitHub <noreply@github.com>
Fri, 29 Dec 2023 03:23:41 +0000 (20:23 -0700)
Content.Client/Explosion/ExplosionOverlaySystem.cs
Content.IntegrationTests/Tests/Payload/ModularGrenadeTests.cs

index 064b068a97e320a2e920e9b102e852eeea42a545..35716616daaa909c7662e577298b6a5d7d81cd62 100644 (file)
@@ -3,6 +3,7 @@ using Robust.Client.Graphics;
 using Robust.Client.ResourceManagement;
 using Robust.Shared.GameStates;
 using Robust.Shared.Graphics.RSI;
+using Robust.Shared.Map;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Utility;
 
@@ -18,6 +19,7 @@ public sealed class ExplosionOverlaySystem : EntitySystem
     [Dependency] private readonly IResourceCache _resCache = default!;
     [Dependency] private readonly IOverlayManager _overlayMan = default!;
     [Dependency] private readonly SharedPointLightSystem _lights = default!;
+    [Dependency] private readonly IMapManager _mapMan = default!;
 
     public override void Initialize()
     {
@@ -65,15 +67,20 @@ public sealed class ExplosionOverlaySystem : EntitySystem
             return;
         }
 
-        // spawn in a client-side light source at the epicenter
-        var lightEntity = Spawn("ExplosionLight", component.Epicenter);
-        var light = _lights.EnsureLight(lightEntity);
+        // Map may have been deleted.
+        if (_mapMan.MapExists(component.Epicenter.MapId))
+        {
+            // spawn in a client-side light source at the epicenter
+            var lightEntity = Spawn("ExplosionLight", component.Epicenter);
+            var light = _lights.EnsureLight(lightEntity);
+
+            _lights.SetRadius(lightEntity, component.Intensity.Count, light);
+            _lights.SetEnergy(lightEntity, component.Intensity.Count, light);
+            _lights.SetColor(lightEntity, type.LightColor, light);
+            textures.LightEntity = lightEntity;
+        }
 
-        _lights.SetRadius(lightEntity, component.Intensity.Count, light);
-        _lights.SetEnergy(lightEntity, component.Intensity.Count, light);
-        _lights.SetColor(lightEntity, type.LightColor, light);
 
-        textures.LightEntity = lightEntity;
         textures.FireColor = type.FireColor;
         textures.IntensityPerState = type.IntensityPerState;
 
index 65f4a9d488af9092ee9e39205429885b10e445b2..0e47de968f0a7d4482973c791379a88508644bb7 100644 (file)
@@ -67,7 +67,7 @@ public sealed class ModularGrenadeTests : InteractionTest
         }
 
         // Grenade has exploded.
-        await RunTicks(5);
+        await RunTicks(30);
         AssertDeleted();
     }
 }