Files
tbd-station-14/Content.Server/Atmos/TileMixtureEnumerator.cs
Leon Friedrich 77e029d4ca Remove atmos method events (#26402)
* Remove HasAtmosphereMethodEvent

* Remove GetTileMixturesMethodEvent

* Remove GetTileMixtureMethodEvent

* Remove GetAdjacentTilesMethodEvent

* Add TileMixtureEnumerator

* Remove GetAdjacentTileMixturesMethodEvent

* Remove IsTileSpaceMethodEvent

* Remove HotspotExposeMethodEvent

* Remove pipe net method events

* Remove device method events

* Use Entity<T>

* Misc fixes

* A

* Theres probably a few more of these

* Fix other resolve errors
2024-03-28 13:22:19 +11:00

30 lines
650 B
C#

using System.Diagnostics.CodeAnalysis;
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;
}
}