Files
tbd-station-14/Content.Server/Atmos/TileAtmosInfo.cs
Víctor Aguilera Puerto fb0ac3d70e Atmos optimizations (#1944)
* Adds IFireAct, ITemperatureExpose

* Use AtmosDirection instead of Direction for Atmos

* Refactor atmos to heavily rely on arrays and bitflags.
Adds F A S T M O S and reduces atmos tech debt heavily.

* Optimize and fix more stuff

* Kinda improve superconduction

* Pipenet is a word

* T U R B O M O S

* Address reviews

* Small optimization

* Superconduct is also a word

* Remove check

* Cleanup tile atmosphere

* Correct a comment
2020-08-28 14:32:56 +02:00

83 lines
2.3 KiB
C#

using System;
using Content.Shared.Atmos;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
namespace Content.Server.Atmos
{
public struct TileAtmosInfo
{
[ViewVariables]
public int LastCycle;
[ViewVariables]
public long LastQueueCycle;
[ViewVariables]
public long LastSlowQueueCycle;
[ViewVariables]
public float MoleDelta;
[ViewVariables]
public float TransferDirectionEast;
[ViewVariables]
public float TransferDirectionWest;
[ViewVariables]
public float TransferDirectionNorth;
[ViewVariables]
public float TransferDirectionSouth;
public float this[AtmosDirection direction]
{
get =>
direction switch
{
AtmosDirection.East => TransferDirectionEast,
AtmosDirection.West => TransferDirectionWest,
AtmosDirection.North => TransferDirectionNorth,
AtmosDirection.South => TransferDirectionSouth,
_ => throw new ArgumentOutOfRangeException(nameof(direction))
};
set
{
switch (direction)
{
case AtmosDirection.East:
TransferDirectionEast = value;
break;
case AtmosDirection.West:
TransferDirectionWest = value;
break;
case AtmosDirection.North:
TransferDirectionNorth = value;
break;
case AtmosDirection.South:
TransferDirectionSouth = value;
break;
default:
throw new ArgumentOutOfRangeException(nameof(direction));
}
}
}
public float this[int index]
{
get => this[(AtmosDirection) (1 << index)];
set => this[(AtmosDirection) (1 << index)] = value;
}
[ViewVariables]
public float CurrentTransferAmount;
public AtmosDirection CurrentTransferDirection;
[ViewVariables]
public bool FastDone;
}
}