make solar flare only open autoclose airlocks (#14635)
* only autoclose airlocks can be opened * use entity query enum
This commit is contained in:
@@ -48,16 +48,17 @@ public sealed class SolarFlare : StationEventSystem
|
|||||||
if (_effectTimer < 0)
|
if (_effectTimer < 0)
|
||||||
{
|
{
|
||||||
_effectTimer += 1;
|
_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))
|
if (RobustRandom.Prob(_event.LightBreakChancePerSecond))
|
||||||
_poweredLight.TryDestroyBulb(comp.Owner, comp);
|
_poweredLight.TryDestroyBulb(uid, light);
|
||||||
}
|
}
|
||||||
|
var airlockQuery = EntityQueryEnumerator<AirlockComponent, DoorComponent>();
|
||||||
foreach (var comp in EntityQuery<DoorComponent>())
|
while (airlockQuery.MoveNext(out var uid, out var airlock, out var door))
|
||||||
{
|
{
|
||||||
if (RobustRandom.Prob(_event.DoorToggleChancePerSecond))
|
if (airlock.AutoClose && RobustRandom.Prob(_event.DoorToggleChancePerSecond))
|
||||||
_door.TryToggleDoor(comp.Owner, comp);
|
_door.TryToggleDoor(uid, door);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user