diff --git a/Content.Server/Anomaly/AnomalySystem.Generator.cs b/Content.Server/Anomaly/AnomalySystem.Generator.cs index 2b20ce75a2..ba7c7b981c 100644 --- a/Content.Server/Anomaly/AnomalySystem.Generator.cs +++ b/Content.Server/Anomaly/AnomalySystem.Generator.cs @@ -162,10 +162,9 @@ public sealed partial class AnomalySystem private void UpdateGenerator() { - foreach (var (active, gen) in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var ent, out var active, out var gen)) { - var ent = active.Owner; - if (Timing.CurTime < active.EndTime) continue; active.AudioStream?.Stop(); diff --git a/Content.Server/Anomaly/AnomalySystem.Scanner.cs b/Content.Server/Anomaly/AnomalySystem.Scanner.cs index 70a3a10268..3cd08b0de1 100644 --- a/Content.Server/Anomaly/AnomalySystem.Scanner.cs +++ b/Content.Server/Anomaly/AnomalySystem.Scanner.cs @@ -27,41 +27,45 @@ public sealed partial class AnomalySystem private void OnScannerAnomalyShutdown(ref AnomalyShutdownEvent args) { - foreach (var component in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var component)) { if (component.ScannedAnomaly != args.Anomaly) continue; - _ui.TryCloseAll(component.Owner, AnomalyScannerUiKey.Key); + _ui.TryCloseAll(uid, AnomalyScannerUiKey.Key); } } private void OnScannerAnomalySeverityChanged(ref AnomalySeverityChangedEvent args) { - foreach (var component in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var component)) { if (component.ScannedAnomaly != args.Anomaly) continue; - UpdateScannerUi(component.Owner, component); + UpdateScannerUi(uid, component); } } private void OnScannerAnomalyStabilityChanged(ref AnomalyStabilityChangedEvent args) { - foreach (var component in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var component)) { if (component.ScannedAnomaly != args.Anomaly) continue; - UpdateScannerUi(component.Owner, component); + UpdateScannerUi(uid, component); } } private void OnScannerAnomalyHealthChanged(ref AnomalyHealthChangedEvent args) { - foreach (var component in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var component)) { if (component.ScannedAnomaly != args.Anomaly) continue; - UpdateScannerUi(component.Owner, component); + UpdateScannerUi(uid, component); } } diff --git a/Content.Server/Anomaly/AnomalySystem.Vessel.cs b/Content.Server/Anomaly/AnomalySystem.Vessel.cs index 8d2710280a..a87555a737 100644 --- a/Content.Server/Anomaly/AnomalySystem.Vessel.cs +++ b/Content.Server/Anomaly/AnomalySystem.Vessel.cs @@ -100,10 +100,9 @@ public sealed partial class AnomalySystem private void OnVesselAnomalyShutdown(ref AnomalyShutdownEvent args) { - foreach (var component in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var ent, out var component)) { - var ent = component.Owner; - if (args.Anomaly != component.Anomaly) continue; @@ -118,9 +117,9 @@ public sealed partial class AnomalySystem private void OnVesselAnomalyStabilityChanged(ref AnomalyStabilityChangedEvent args) { - foreach (var component in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var ent, out var component)) { - var ent = component.Owner; if (args.Anomaly != component.Anomaly) continue; @@ -171,9 +170,9 @@ public sealed partial class AnomalySystem private void UpdateVessels() { - foreach (var vessel in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var vesselEnt, out var vessel)) { - var vesselEnt = vessel.Owner; if (vessel.Anomaly is not { } anomUid) continue; diff --git a/Content.Server/Anomaly/AnomalySystem.cs b/Content.Server/Anomaly/AnomalySystem.cs index 3e7122695f..3de46afb46 100644 --- a/Content.Server/Anomaly/AnomalySystem.cs +++ b/Content.Server/Anomaly/AnomalySystem.cs @@ -7,7 +7,6 @@ using Content.Server.Materials; using Content.Server.Radio.EntitySystems; using Content.Shared.Anomaly; using Content.Shared.Anomaly.Components; -using Content.Shared.DoAfter; using Robust.Server.GameObjects; using Robust.Shared.Configuration; using Robust.Shared.Physics.Events; diff --git a/Content.Server/Anomaly/Components/AnomalousParticleComponent.cs b/Content.Server/Anomaly/Components/AnomalousParticleComponent.cs index 195fe5a941..6d8e248c14 100644 --- a/Content.Server/Anomaly/Components/AnomalousParticleComponent.cs +++ b/Content.Server/Anomaly/Components/AnomalousParticleComponent.cs @@ -5,7 +5,7 @@ namespace Content.Server.Anomaly.Components; /// /// This is used for projectiles which affect anomalies through colliding with them. /// -[RegisterComponent] +[RegisterComponent, Access(typeof(SharedAnomalySystem))] public sealed class AnomalousParticleComponent : Component { /// diff --git a/Content.Server/Anomaly/Components/AnomalyGeneratorComponent.cs b/Content.Server/Anomaly/Components/AnomalyGeneratorComponent.cs index 0b27ee7d1b..fdb9d2e721 100644 --- a/Content.Server/Anomaly/Components/AnomalyGeneratorComponent.cs +++ b/Content.Server/Anomaly/Components/AnomalyGeneratorComponent.cs @@ -1,4 +1,5 @@ -using Content.Shared.Materials; +using Content.Shared.Anomaly; +using Content.Shared.Materials; using Content.Shared.Radio; using Robust.Shared.Audio; using Robust.Shared.Prototypes; @@ -11,7 +12,7 @@ namespace Content.Server.Anomaly.Components; /// This is used for a machine that is able to generate /// anomalies randomly on the station. /// -[RegisterComponent] +[RegisterComponent, Access(typeof(SharedAnomalySystem))] public sealed class AnomalyGeneratorComponent : Component { /// diff --git a/Content.Server/Anomaly/Components/AnomalyScannerComponent.cs b/Content.Server/Anomaly/Components/AnomalyScannerComponent.cs index cf40950224..c7259ee468 100644 --- a/Content.Server/Anomaly/Components/AnomalyScannerComponent.cs +++ b/Content.Server/Anomaly/Components/AnomalyScannerComponent.cs @@ -1,4 +1,4 @@ -using System.Threading; +using Content.Shared.Anomaly; using Robust.Shared.Audio; namespace Content.Server.Anomaly.Components; @@ -7,7 +7,7 @@ namespace Content.Server.Anomaly.Components; /// This is used for scanning anomalies and /// displaying information about them in the ui /// -[RegisterComponent] +[RegisterComponent, Access(typeof(SharedAnomalySystem))] public sealed class AnomalyScannerComponent : Component { /// diff --git a/Content.Server/Anomaly/Components/AnomalyVesselComponent.cs b/Content.Server/Anomaly/Components/AnomalyVesselComponent.cs index 2d502f0ea3..92d3f76062 100644 --- a/Content.Server/Anomaly/Components/AnomalyVesselComponent.cs +++ b/Content.Server/Anomaly/Components/AnomalyVesselComponent.cs @@ -1,4 +1,5 @@ -using Content.Shared.Construction.Prototypes; +using Content.Shared.Anomaly; +using Content.Shared.Construction.Prototypes; using Robust.Shared.Audio; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; @@ -11,7 +12,7 @@ namespace Content.Server.Anomaly.Components; /// they generate points for the selected server based on /// the anomaly's stability and severity. /// -[RegisterComponent] +[RegisterComponent, Access(typeof(SharedAnomalySystem))] public sealed class AnomalyVesselComponent : Component { /// diff --git a/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs b/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs index 9e30d66c90..8e4eb60399 100644 --- a/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs +++ b/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs @@ -1,9 +1,10 @@ -using Robust.Shared.Audio; +using Content.Shared.Anomaly; +using Robust.Shared.Audio; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Server.Anomaly.Components; -[RegisterComponent] +[RegisterComponent, Access(typeof(SharedAnomalySystem))] public sealed class GeneratingAnomalyGeneratorComponent : Component { /// diff --git a/Content.Server/Anomaly/Effects/PyroclasticAnomalySystem.cs b/Content.Server/Anomaly/Effects/PyroclasticAnomalySystem.cs index 5d86c31f46..8144a5143c 100644 --- a/Content.Server/Anomaly/Effects/PyroclasticAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/PyroclasticAnomalySystem.cs @@ -49,7 +49,7 @@ public sealed class PyroclasticAnomalySystem : EntitySystem { foreach (var ind in _atmosphere.GetAdjacentTiles(grid.Value, indices)) { - var mix = _atmosphere.GetTileMixture(grid, map, indices, true); + var mix = _atmosphere.GetTileMixture(grid, map, ind, true); if (mix is not { }) continue; @@ -65,10 +65,9 @@ public sealed class PyroclasticAnomalySystem : EntitySystem { base.Update(frameTime); - foreach (var (pyro, anom, xform) in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var ent, out var pyro, out var anom, out var xform)) { - var ent = pyro.Owner; - var grid = xform.GridUid; var map = xform.MapUid; var indices = _xform.GetGridOrMapTilePosition(ent, xform); diff --git a/Content.Shared/Anomaly/Components/AnomalyComponent.cs b/Content.Shared/Anomaly/Components/AnomalyComponent.cs index 50f128d145..813b3b38c1 100644 --- a/Content.Shared/Anomaly/Components/AnomalyComponent.cs +++ b/Content.Shared/Anomaly/Components/AnomalyComponent.cs @@ -13,7 +13,7 @@ namespace Content.Shared.Anomaly.Components; /// /// Anomalies and their related components were designed here: https://hackmd.io/@ss14-design/r1sQbkJOs /// -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, Access(typeof(SharedAnomalySystem))] public sealed class AnomalyComponent : Component { /// diff --git a/Content.Shared/Anomaly/Components/AnomalyPulsingComponent.cs b/Content.Shared/Anomaly/Components/AnomalyPulsingComponent.cs index 9c12ec11c8..7321a279fd 100644 --- a/Content.Shared/Anomaly/Components/AnomalyPulsingComponent.cs +++ b/Content.Shared/Anomaly/Components/AnomalyPulsingComponent.cs @@ -5,7 +5,7 @@ namespace Content.Shared.Anomaly.Components; /// /// This component tracks anomalies that are currently pulsing /// -[RegisterComponent] +[RegisterComponent, Access(typeof(SharedAnomalySystem))] public sealed class AnomalyPulsingComponent : Component { /// diff --git a/Content.Shared/Anomaly/Components/AnomalySupercriticalComponent.cs b/Content.Shared/Anomaly/Components/AnomalySupercriticalComponent.cs index bc5bb381ef..14751d726c 100644 --- a/Content.Shared/Anomaly/Components/AnomalySupercriticalComponent.cs +++ b/Content.Shared/Anomaly/Components/AnomalySupercriticalComponent.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Anomaly.Components; /// /// Tracks anomalies going supercritical /// -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, Access(typeof(SharedAnomalySystem))] public sealed class AnomalySupercriticalComponent : Component { /// diff --git a/Content.Shared/Anomaly/Effects/Components/BluespaceAnomalyComponent.cs b/Content.Shared/Anomaly/Effects/Components/BluespaceAnomalyComponent.cs index 446194188b..03b9c3fef0 100644 --- a/Content.Shared/Anomaly/Effects/Components/BluespaceAnomalyComponent.cs +++ b/Content.Shared/Anomaly/Effects/Components/BluespaceAnomalyComponent.cs @@ -3,8 +3,7 @@ using Robust.Shared.GameStates; namespace Content.Shared.Anomaly.Effects.Components; -[RegisterComponent, NetworkedComponent] -[Access(typeof(BluespaceAnomalySystem))] +[RegisterComponent, NetworkedComponent, Access(typeof(BluespaceAnomalySystem))] public sealed class BluespaceAnomalyComponent : Component { /// diff --git a/Content.Shared/Anomaly/Effects/Components/GravityAnomalyComponent.cs b/Content.Shared/Anomaly/Effects/Components/GravityAnomalyComponent.cs index 761bc9daec..1ede852f7d 100644 --- a/Content.Shared/Anomaly/Effects/Components/GravityAnomalyComponent.cs +++ b/Content.Shared/Anomaly/Effects/Components/GravityAnomalyComponent.cs @@ -2,7 +2,7 @@ namespace Content.Shared.Anomaly.Effects.Components; -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, Access(typeof(SharedGravityAnomalySystem))] public sealed class GravityAnomalyComponent : Component { /// diff --git a/Content.Shared/Anomaly/SharedAnomalySystem.cs b/Content.Shared/Anomaly/SharedAnomalySystem.cs index 874e28ebcd..3ff305f7fe 100644 --- a/Content.Shared/Anomaly/SharedAnomalySystem.cs +++ b/Content.Shared/Anomaly/SharedAnomalySystem.cs @@ -312,10 +312,9 @@ public abstract class SharedAnomalySystem : EntitySystem { base.Update(frameTime); - foreach (var anomaly in EntityQuery()) + var anomalyQuery = EntityQueryEnumerator(); + while (anomalyQuery.MoveNext(out var ent, out var anomaly)) { - var ent = anomaly.Owner; - // if the stability is under the death threshold, // update it every second to start killing it slowly. if (anomaly.Stability < anomaly.DecayThreshold) @@ -329,10 +328,9 @@ public abstract class SharedAnomalySystem : EntitySystem } } - foreach (var pulse in EntityQuery()) + var pulseQuery = EntityQueryEnumerator(); + while (pulseQuery.MoveNext(out var ent, out var pulse)) { - var ent = pulse.Owner; - if (Timing.CurTime > pulse.EndTime) { Appearance.SetData(ent, AnomalyVisuals.IsPulsing, false); @@ -340,10 +338,9 @@ public abstract class SharedAnomalySystem : EntitySystem } } - foreach (var (super, anom) in EntityQuery()) + var supercriticalQuery = EntityQueryEnumerator(); + while (supercriticalQuery.MoveNext(out var ent, out var super, out var anom)) { - var ent = anom.Owner; - if (Timing.CurTime <= super.EndTime) continue; DoAnomalySupercriticalEvent(ent, anom);