]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
make solar flare only open autoclose airlocks (#14635)
authorSlava0135 <40753025+Slava0135@users.noreply.github.com>
Sat, 18 Mar 2023 10:57:38 +0000 (13:57 +0300)
committerGitHub <noreply@github.com>
Sat, 18 Mar 2023 10:57:38 +0000 (11:57 +0100)
* only autoclose airlocks can be opened

* use entity query enum

Content.Server/StationEvents/Events/SolarFlare.cs

index 1baf45862b19f46ad454baffe7ab81273e53fab3..9c1b3114dbc77a39c46b29a1911def410855d9cb 100644 (file)
@@ -48,16 +48,17 @@ public sealed class SolarFlare : StationEventSystem
         if (_effectTimer < 0)
         {
             _effectTimer += 1;
-            foreach (var comp in EntityQuery<PoweredLightComponent>())
+            var lightQuery = EntityQueryEnumerator<PoweredLightComponent>();
+            while (lightQuery.MoveNext(out var uid, out var light))
             {
                 if (RobustRandom.Prob(_event.LightBreakChancePerSecond))
-                    _poweredLight.TryDestroyBulb(comp.Owner, comp);
+                    _poweredLight.TryDestroyBulb(uid, light);
             }
-
-            foreach (var comp in EntityQuery<DoorComponent>())
+            var airlockQuery = EntityQueryEnumerator<AirlockComponent, DoorComponent>();
+            while (airlockQuery.MoveNext(out var uid, out var airlock, out var door))
             {
-                if (RobustRandom.Prob(_event.DoorToggleChancePerSecond))
-                    _door.TryToggleDoor(comp.Owner, comp);
+                if (airlock.AutoClose && RobustRandom.Prob(_event.DoorToggleChancePerSecond))
+                    _door.TryToggleDoor(uid, door);
             }
         }