Files
Delta-v/Content.Server/Atmos/TileMixtureEnumerator.cs
T
Jezithyr 17ff17a0d0 Move GasMixture to shared (#27480)
* Moved GasMixture to shared

* Temp Fix for sandbox violation, idk why Array.Resize isn't working properly. It's already sandboxed.

* The most powerful webedit in history
2024-05-07 04:00:15 +02:00

31 lines
678 B
C#

using System.Diagnostics.CodeAnalysis;
using Content.Shared.Atmos;
namespace Content.Server.Atmos;
public struct TileMixtureEnumerator
{
public readonly TileAtmosphere?[] Tiles;
public int Index = 0;
public static readonly TileMixtureEnumerator Empty = new(Array.Empty<TileAtmosphere>());
internal TileMixtureEnumerator(TileAtmosphere?[] tiles)
{
Tiles = tiles;
}
public bool MoveNext([NotNullWhen(true)] out GasMixture? mix)
{
while (Index < Tiles.Length)
{
mix = Tiles[Index++]?.Air;
if (mix != null)
return true;
}
mix = null;
return false;
}
}