Navmap rework (#26713)
* Optimized the drawing of lines and tracked entities * Optimized nav map updating and added thin wall support * Added support for thin doors * Removed floor tile seams, more line drawing optimizations * Fixed split grids not updating correctly * Cleaned up NavMapControl code * Fix nav map header * Converted nav map updates from system network messages to delta-states * Addressed review comments * Fixed timing issue where NavMapSystem would update before AirtightSystem did
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.Pinpointer;
|
||||
|
||||
/// <summary>
|
||||
/// Used to store grid poly data to be used for UIs.
|
||||
/// Used to store grid data to be used for UIs.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class NavMapComponent : Component
|
||||
@@ -12,25 +15,57 @@ public sealed partial class NavMapComponent : Component
|
||||
* Don't need DataFields as this can be reconstructed
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Bitmasks that represent chunked tiles.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public readonly Dictionary<Vector2i, NavMapChunk> Chunks = new();
|
||||
public Dictionary<(NavMapChunkType, Vector2i), NavMapChunk> Chunks = new();
|
||||
|
||||
[ViewVariables] public readonly List<SharedNavMapSystem.NavMapBeacon> Beacons = new();
|
||||
|
||||
[ViewVariables] public readonly List<SharedNavMapSystem.NavMapAirlock> Airlocks = new();
|
||||
/// <summary>
|
||||
/// List of station beacons.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public HashSet<SharedNavMapSystem.NavMapBeacon> Beacons = new();
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NavMapChunk
|
||||
{
|
||||
/// <summary>
|
||||
/// The chunk origin
|
||||
/// </summary>
|
||||
public readonly Vector2i Origin;
|
||||
|
||||
/// <summary>
|
||||
/// Bitmask for tiles, 1 for occupied and 0 for empty.
|
||||
/// Bitmask for tiles, 1 for occupied and 0 for empty. There is a bitmask for each cardinal direction,
|
||||
/// representing each edge of the tile, in case the entities inside it do not entirely fill it
|
||||
/// </summary>
|
||||
public int TileData;
|
||||
public Dictionary<AtmosDirection, ushort> TileData;
|
||||
|
||||
/// <summary>
|
||||
/// The last game tick that the chunk was updated
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
public GameTick LastUpdate;
|
||||
|
||||
public NavMapChunk(Vector2i origin)
|
||||
{
|
||||
Origin = origin;
|
||||
|
||||
TileData = new()
|
||||
{
|
||||
[AtmosDirection.North] = 0,
|
||||
[AtmosDirection.East] = 0,
|
||||
[AtmosDirection.South] = 0,
|
||||
[AtmosDirection.West] = 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public enum NavMapChunkType : byte
|
||||
{
|
||||
Invalid,
|
||||
Floor,
|
||||
Wall,
|
||||
Airlock,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user