From 6d3863f8a0619c293587dca3b4de2b48fd9aeaa7 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Sun, 25 Jul 2021 15:05:05 +0200 Subject: [PATCH] Remove EntityNetworkUtils, move extension methods to AtmosDirection class. --- Content.Server/Atmos/EntityNetworkUtils.cs | 30 ---------------------- Content.Shared/Atmos/AtmosDirection.cs | 22 ++++++++++++++++ 2 files changed, 22 insertions(+), 30 deletions(-) delete mode 100644 Content.Server/Atmos/EntityNetworkUtils.cs diff --git a/Content.Server/Atmos/EntityNetworkUtils.cs b/Content.Server/Atmos/EntityNetworkUtils.cs deleted file mode 100644 index 7b1671b6e6..0000000000 --- a/Content.Server/Atmos/EntityNetworkUtils.cs +++ /dev/null @@ -1,30 +0,0 @@ -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(); - } - } -} diff --git a/Content.Shared/Atmos/AtmosDirection.cs b/Content.Shared/Atmos/AtmosDirection.cs index 96023a55e8..5093b5245b 100644 --- a/Content.Shared/Atmos/AtmosDirection.cs +++ b/Content.Shared/Atmos/AtmosDirection.cs @@ -142,6 +142,28 @@ namespace Content.Shared.Atmos { return (direction & other) == other; } + + 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 + dir.CardinalToIntVec(); + } } public sealed class AtmosDirectionFlags { }