Anomaly cleanup (#14781)
This commit is contained in:
@@ -162,10 +162,9 @@ public sealed partial class AnomalySystem
|
||||
|
||||
private void UpdateGenerator()
|
||||
{
|
||||
foreach (var (active, gen) in EntityQuery<GeneratingAnomalyGeneratorComponent, AnomalyGeneratorComponent>())
|
||||
var query = EntityQueryEnumerator<GeneratingAnomalyGeneratorComponent, AnomalyGeneratorComponent>();
|
||||
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();
|
||||
|
||||
@@ -27,41 +27,45 @@ public sealed partial class AnomalySystem
|
||||
|
||||
private void OnScannerAnomalyShutdown(ref AnomalyShutdownEvent args)
|
||||
{
|
||||
foreach (var component in EntityQuery<AnomalyScannerComponent>())
|
||||
var query = EntityQueryEnumerator<AnomalyScannerComponent>();
|
||||
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<AnomalyScannerComponent>())
|
||||
var query = EntityQueryEnumerator<AnomalyScannerComponent>();
|
||||
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<AnomalyScannerComponent>())
|
||||
var query = EntityQueryEnumerator<AnomalyScannerComponent>();
|
||||
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<AnomalyScannerComponent>())
|
||||
var query = EntityQueryEnumerator<AnomalyScannerComponent>();
|
||||
while (query.MoveNext(out var uid, out var component))
|
||||
{
|
||||
if (component.ScannedAnomaly != args.Anomaly)
|
||||
continue;
|
||||
UpdateScannerUi(component.Owner, component);
|
||||
UpdateScannerUi(uid, component);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,10 +100,9 @@ public sealed partial class AnomalySystem
|
||||
|
||||
private void OnVesselAnomalyShutdown(ref AnomalyShutdownEvent args)
|
||||
{
|
||||
foreach (var component in EntityQuery<AnomalyVesselComponent>())
|
||||
var query = EntityQueryEnumerator<AnomalyVesselComponent>();
|
||||
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<AnomalyVesselComponent>())
|
||||
var query = EntityQueryEnumerator<AnomalyVesselComponent>();
|
||||
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<AnomalyVesselComponent>())
|
||||
var query = EntityQueryEnumerator<AnomalyVesselComponent>();
|
||||
while (query.MoveNext(out var vesselEnt, out var vessel))
|
||||
{
|
||||
var vesselEnt = vessel.Owner;
|
||||
if (vessel.Anomaly is not { } anomUid)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Content.Server.Anomaly.Components;
|
||||
/// <summary>
|
||||
/// This is used for projectiles which affect anomalies through colliding with them.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[RegisterComponent, Access(typeof(SharedAnomalySystem))]
|
||||
public sealed class AnomalousParticleComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -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.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[RegisterComponent, Access(typeof(SharedAnomalySystem))]
|
||||
public sealed class AnomalyGeneratorComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -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
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[RegisterComponent, Access(typeof(SharedAnomalySystem))]
|
||||
public sealed class AnomalyScannerComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -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.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[RegisterComponent, Access(typeof(SharedAnomalySystem))]
|
||||
public sealed class AnomalyVesselComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -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<PyroclasticAnomalyComponent, AnomalyComponent, TransformComponent>())
|
||||
var query = EntityQueryEnumerator<PyroclasticAnomalyComponent, AnomalyComponent, TransformComponent>();
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user