From aeb50893daefc830334e23bb554e790d41f5806e Mon Sep 17 00:00:00 2001 From: metalgearsloth Date: Tue, 15 Oct 2024 20:25:51 +1100 Subject: [PATCH] Tile flag --- Robust.Shared/Map/Tile.cs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Robust.Shared/Map/Tile.cs b/Robust.Shared/Map/Tile.cs index 23c6ad9f389..35304d7225e 100644 --- a/Robust.Shared/Map/Tile.cs +++ b/Robust.Shared/Map/Tile.cs @@ -1,5 +1,6 @@ using System; using JetBrains.Annotations; +using Robust.Shared.Serialization; using Robust.Shared.Utility; namespace Robust.Shared.Map; @@ -20,6 +21,11 @@ namespace Robust.Shared.Map; /// public readonly TileRenderFlag Flags; + /// + /// Tile-flags for content usage. + /// + public readonly ushort ContentFlag; + /// /// Variant of this tile to render. /// @@ -41,11 +47,13 @@ namespace Robust.Shared.Map; /// Internal type ID. /// Flags used by toolbox's rendering. /// The visual variant this tile is using. - public Tile(int typeId, TileRenderFlag flags = 0, byte variant = 0) + /// + public Tile(int typeId, TileRenderFlag flags = 0, byte variant = 0, ushort contentFlag = 0) { TypeId = typeId; Flags = flags; Variant = variant; + ContentFlag = contentFlag; } /// @@ -93,7 +101,7 @@ public bool TryFormat( /// public bool Equals(Tile other) { - return TypeId == other.TypeId && Flags == other.Flags && Variant == other.Variant; + return TypeId == other.TypeId && Flags == other.Flags && Variant == other.Variant && ContentFlag == other.ContentFlag; } /// @@ -112,8 +120,22 @@ public override int GetHashCode() return (TypeId.GetHashCode() * 397) ^ Flags.GetHashCode() ^ Variant.GetHashCode(); } } + + [Pure] + public Tile WithContentFlag(ushort tileContentFlag) + { + return new Tile(typeId: TypeId, flags: Flags, variant: Variant, contentFlag: tileContentFlag); + } + + [Pure] + public Tile WithVariant(byte variant) + { + return new Tile(TypeId, Flags, variant, ContentFlag); + } } +public sealed class TileFlagLayer {} + public enum TileRenderFlag : byte {