using System.Collections.Concurrent;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Serialization;
using Content.Server.NodeContainer.NodeGroups;
using Content.Shared.Atmos.Components;
namespace Content.Server.Atmos.Components
{
///
/// Internal Atmos class. Use to interact with atmos instead.
///
[RegisterComponent, Serializable,
Access(typeof(AtmosphereSystem), typeof(GasTileOverlaySystem), typeof(AtmosDebugOverlaySystem))]
public sealed partial class GridAtmosphereComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
public bool Simulated { get; set; } = true;
[ViewVariables]
public bool ProcessingPaused { get; set; } = false;
[ViewVariables]
public float Timer { get; set; } = 0f;
[ViewVariables]
public int UpdateCounter { get; set; } = 1; // DO NOT SET TO ZERO BY DEFAULT! It will break roundstart atmos...
[ViewVariables]
[IncludeDataField(customTypeSerializer:typeof(TileAtmosCollectionSerializer))]
public Dictionary Tiles = new(1000);
[ViewVariables]
public HashSet MapTiles = new(1000);
[ViewVariables]
public readonly HashSet ActiveTiles = new(1000);
[ViewVariables]
public int ActiveTilesCount => ActiveTiles.Count;
[ViewVariables]
public readonly HashSet ExcitedGroups = new(1000);
[ViewVariables]
public int ExcitedGroupCount => ExcitedGroups.Count;
[ViewVariables]
public readonly HashSet HotspotTiles = new(1000);
[ViewVariables]
public int HotspotTilesCount => HotspotTiles.Count;
[ViewVariables]
public readonly HashSet SuperconductivityTiles = new(1000);
[ViewVariables]
public int SuperconductivityTilesCount => SuperconductivityTiles.Count;
[ViewVariables]
public HashSet HighPressureDelta = new(1000);
[ViewVariables]
public int HighPressureDeltaCount => HighPressureDelta.Count;
///
/// A list of entities that have a and are to
/// be processed by the , if enabled.
///
/// To prevent massive bookkeeping overhead, this list is processed in-place,
/// with add/remove/find operations helped via a dict.
///
/// If you want to add/remove/find entities in this list,
/// use the API methods in the Atmospherics API.
[ViewVariables]
public readonly List> DeltaPressureEntities =
new(AtmosphereSystem.DeltaPressurePreAllocateLength);
///
/// An index lookup for the list.
/// Used for add/remove/find operations to speed up processing.
///
public readonly Dictionary DeltaPressureEntityLookup =
new(AtmosphereSystem.DeltaPressurePreAllocateLength);
///
/// Integer that indicates the current position in the
/// list that is being processed.
///
[ViewVariables(VVAccess.ReadOnly)]
public int DeltaPressureCursor;
///
/// Queue of entities that need to have damage applied to them.
///
[ViewVariables]
public readonly ConcurrentQueue DeltaPressureDamageResults = new();
[ViewVariables]
public readonly HashSet PipeNets = new();
[ViewVariables]
public readonly HashSet> AtmosDevices = new();
[ViewVariables]
public readonly Queue CurrentRunTiles = new();
[ViewVariables]
public readonly Queue CurrentRunExcitedGroups = new();
[ViewVariables]
public readonly Queue CurrentRunPipeNet = new();
[ViewVariables]
public readonly Queue> CurrentRunAtmosDevices = new();
[ViewVariables]
public readonly HashSet InvalidatedCoords = new(1000);
[ViewVariables]
public readonly Queue CurrentRunInvalidatedTiles = new();
[ViewVariables]
public readonly List PossiblyDisconnectedTiles = new(100);
[ViewVariables]
public int InvalidatedCoordsCount => InvalidatedCoords.Count;
[ViewVariables]
public long EqualizationQueueCycleControl { get; set; }
[ViewVariables]
public AtmosphereProcessingState State { get; set; } = AtmosphereProcessingState.Revalidate;
}
}