Minor atmos optimization

This commit is contained in:
Víctor Aguilera Puerto
2020-08-10 02:53:42 +02:00
parent c385947b48
commit 6a06358012
2 changed files with 5 additions and 6 deletions

View File

@@ -13,7 +13,6 @@ using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Timing; using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
@@ -191,7 +190,7 @@ namespace Content.Server.GameObjects.Components.Atmos
tile.UpdateAdjacent(); tile.UpdateAdjacent();
tile.UpdateVisuals(); tile.UpdateVisuals();
foreach (var direction in Cardinal()) foreach (var direction in Cardinal)
{ {
var otherIndices = indices.Offset(direction); var otherIndices = indices.Offset(direction);
var otherTile = GetTile(otherIndices); var otherTile = GetTile(otherIndices);
@@ -306,7 +305,7 @@ namespace Content.Server.GameObjects.Components.Atmos
public Dictionary<Direction, TileAtmosphere> GetAdjacentTiles(MapIndices indices) public Dictionary<Direction, TileAtmosphere> GetAdjacentTiles(MapIndices indices)
{ {
var sides = new Dictionary<Direction, TileAtmosphere>(); var sides = new Dictionary<Direction, TileAtmosphere>();
foreach (var dir in Cardinal()) foreach (var dir in Cardinal)
{ {
var side = indices.Offset(dir); var side = indices.Offset(dir);
var tile = GetTile(side); var tile = GetTile(side);
@@ -475,7 +474,7 @@ namespace Content.Server.GameObjects.Components.Atmos
return null; return null;
} }
private static IEnumerable<Direction> Cardinal() => private static readonly Direction[] Cardinal =
new [] new []
{ {
Direction.North, Direction.East, Direction.South, Direction.West Direction.North, Direction.East, Direction.South, Direction.West

View File

@@ -59,7 +59,7 @@ namespace Content.Shared.Atmos
public const float CellVolume = 2500f; public const float CellVolume = 2500f;
/// <summary> /// <summary>
/// Moles in a 2.5 m^3 cell at 101.325 Pa and 20ºC /// Moles in a 2.5 m^3 cell at 101.325 kPa and 20ºC
/// </summary> /// </summary>
public const float MolesCellStandard = (OneAtmosphere * CellVolume / (T20C * R)); public const float MolesCellStandard = (OneAtmosphere * CellVolume / (T20C * R));