Files
tbd-station-14/Content.Server/Atmos/EntityNetworkUtils.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

31 lines
905 B
C#

using System;
using Robust.Shared.Maths;
namespace Content.Server.Atmos
{
public static class EntityNetworkUtils
{
public static Vector2i CardinalToIntVec(this Direction dir)
{
switch (dir)
{
case Direction.North:
return new Vector2i(0, 1);
case Direction.East:
return new Vector2i(1, 0);
case Direction.South:
return new Vector2i(0, -1);
case Direction.West:
return new Vector2i(-1, 0);
default:
throw new ArgumentException($"Direction dir {dir} is not a cardinal direction", nameof(dir));
}
}
public static Vector2i Offset(this Vector2i pos, Direction dir)
{
return pos + (Vector2i) dir.CardinalToIntVec();
}
}
}