Anomaly cleanup (#14781)

This commit is contained in:
Nemanja
2023-03-23 01:53:32 -04:00
committed by GitHub
parent 3a545a171e
commit d5d9046fb6
16 changed files with 46 additions and 47 deletions

View File

@@ -13,7 +13,7 @@ namespace Content.Shared.Anomaly.Components;
///
/// Anomalies and their related components were designed here: https://hackmd.io/@ss14-design/r1sQbkJOs
/// </summary>
[RegisterComponent, NetworkedComponent]
[RegisterComponent, NetworkedComponent, Access(typeof(SharedAnomalySystem))]
public sealed class AnomalyComponent : Component
{
/// <summary>

View File

@@ -5,7 +5,7 @@ namespace Content.Shared.Anomaly.Components;
/// <summary>
/// This component tracks anomalies that are currently pulsing
/// </summary>
[RegisterComponent]
[RegisterComponent, Access(typeof(SharedAnomalySystem))]
public sealed class AnomalyPulsingComponent : Component
{
/// <summary>

View File

@@ -7,7 +7,7 @@ namespace Content.Shared.Anomaly.Components;
/// <summary>
/// Tracks anomalies going supercritical
/// </summary>
[RegisterComponent, NetworkedComponent]
[RegisterComponent, NetworkedComponent, Access(typeof(SharedAnomalySystem))]
public sealed class AnomalySupercriticalComponent : Component
{
/// <summary>

View File

@@ -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
{
/// <summary>

View File

@@ -2,7 +2,7 @@
namespace Content.Shared.Anomaly.Effects.Components;
[RegisterComponent, NetworkedComponent]
[RegisterComponent, NetworkedComponent, Access(typeof(SharedGravityAnomalySystem))]
public sealed class GravityAnomalyComponent : Component
{
/// <summary>

View File

@@ -312,10 +312,9 @@ public abstract class SharedAnomalySystem : EntitySystem
{
base.Update(frameTime);
foreach (var anomaly in EntityQuery<AnomalyComponent>())
var anomalyQuery = EntityQueryEnumerator<AnomalyComponent>();
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<AnomalyPulsingComponent>())
var pulseQuery = EntityQueryEnumerator<AnomalyPulsingComponent>();
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<AnomalySupercriticalComponent, AnomalyComponent>())
var supercriticalQuery = EntityQueryEnumerator<AnomalySupercriticalComponent, AnomalyComponent>();
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);