Files
RobustToolbox/Robust.Shared/Map/MapId.cs
f2625bf5c5 Removes IMapManager (#6584)
* Move MapManager queries to SharedMapSystem
Moves all variants of FindGridsIntersecting/TryFindGridAt to SharedMapSystem
Hollows out the MapManager methods and converts them into relays to SharedMapSystem

* Move CreateGrid to SharedMapSystem
Moves the functionality for CreateGrid and its variants to SharedMapSystem
Hollows out the MapManager methods and converts them into relays for the SharedMapSystem methods
Obsoletes them too
Also moves over the GetAllMapGrids and GetAllGrids methods

* Move RaiseOnTileChanged to SharedMapSystem
Also moves the SuppressOnTileChanged flag member to SharedMapSystem
Hollows out and obsoletes the MapManager versions

* Move default value constants to SharedMapSystem

* Converts map pausing events into LocalizedEntityCommands

* Move MapManager related delegates/structs to SharedMapSystem
Moves the GridCreationOptions struct to the same namespace as SharedMapSystem and converts it into a record struct
Move the GridCallback delegates to the same namespace as SharedMapSystem

* Move CullDeletionHistory to SharedMapSystem
Well, that was less painful than I thought it would be

* Actually obsolete the NetworkedMapManager method

* Rename file

* Doc comments for new SharedMapSystem methods

* Doc comment

* Doc comments

* Fix access

* Purge all references to IMapManagerInternal

* Cull easy IMapManager references

* The rest

* Purge IMapManager

* Private internal FindGridsIntersecting method

* please die

* 41

* notes

---------

Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
2026-07-01 19:32:17 -07:00

74 lines
2.0 KiB
C#

using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Robust.Shared.Map
{
/// <summary>
/// Uniquely identifies a map.
/// </summary>
/// <remarks>
/// All maps, aside from <see cref="Nullspace"/>, are also entities. When writing generic code it's usually
/// preferable to use <see cref="EntityUid"/> or <see cref="Entity{T}"/> instead.
/// </remarks>
/// <seealso cref="SharedMapSystem"/>
[Serializable, NetSerializable]
public readonly struct MapId : IEquatable<MapId>
{
/// <summary>
/// The equivalent of <c>null</c> for maps. There is no map entity assigned to this and anything here is
/// a root (has no parent) for the <see cref="TransformComponent">transform hierarchy</see>.<br/>
/// All map entities live in nullspace and function as roots, for example.
/// </summary>
public static readonly MapId Nullspace = new(0);
internal readonly int Value;
public MapId(int value)
{
Value = value;
}
/// <inheritdoc />
public bool Equals(MapId other)
{
return Value == other.Value;
}
/// <inheritdoc />
public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj)) return false;
return obj is MapId id && Equals(id);
}
/// <inheritdoc />
public override int GetHashCode()
{
return Value;
}
public static bool operator ==(MapId a, MapId b)
{
return a.Value == b.Value;
}
public static bool operator !=(MapId a, MapId b)
{
return !(a == b);
}
public static explicit operator int(MapId self)
{
return self.Value;
}
public override string ToString()
{
return IsClientSide ? $"c{-Value}" : Value.ToString();
}
public bool IsClientSide => Value < 0;
}
}