Files
crystall-punk-14/Content.Shared/Pinpointer/NavMapComponent.cs

63 lines
1.6 KiB
C#
Raw Normal View History

using System.Linq;
using Content.Shared.Atmos;
2023-04-13 16:21:24 +10:00
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Timing;
2023-04-13 16:21:24 +10:00
namespace Content.Shared.Pinpointer;
/// <summary>
/// Used to store grid data to be used for UIs.
2023-04-13 16:21:24 +10:00
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class NavMapComponent : Component
2023-04-13 16:21:24 +10:00
{
2023-09-16 18:11:47 +10:00
/*
* Don't need DataFields as this can be reconstructed
*/
/// <summary>
/// Bitmasks that represent chunked tiles.
/// </summary>
2023-04-13 16:21:24 +10:00
[ViewVariables]
public Dictionary<Vector2i, NavMapChunk> Chunks = new();
2023-09-16 18:11:47 +10:00
/// <summary>
/// List of station beacons.
/// </summary>
[ViewVariables]
public Dictionary<NetEntity, SharedNavMapSystem.NavMapBeacon> Beacons = new();
2023-04-13 16:21:24 +10:00
}
[Serializable, NetSerializable]
public sealed class NavMapChunk(Vector2i origin)
2023-04-13 16:21:24 +10:00
{
/// <summary>
/// The chunk origin
/// </summary>
[ViewVariables]
public readonly Vector2i Origin = origin;
2023-04-13 16:21:24 +10:00
/// <summary>
/// Array containing the chunk's data. The
2023-04-13 16:21:24 +10:00
/// </summary>
[ViewVariables]
public int[] TileData = new int[SharedNavMapSystem.ArraySize];
/// <summary>
/// The last game tick that the chunk was updated
/// </summary>
[NonSerialized]
public GameTick LastUpdate;
2023-04-13 16:21:24 +10:00
}
public enum NavMapChunkType : byte
{
// Values represent bit shift offsets when retrieving data in the tile array.
Invalid = byte.MaxValue,
Floor = 0, // I believe floors have directional information for diagonal tiles?
Wall = SharedNavMapSystem.Directions,
Airlock = 2 * SharedNavMapSystem.Directions,
}