Code Cleanup: Purge obsolete MapManager methods (#26279)
* GetGrid * GridExists * TryGetGrid
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Shared.Maps
|
||||
@@ -14,11 +15,11 @@ namespace Content.Shared.Maps
|
||||
/// <summary>
|
||||
/// Attempts to get the turf at map indices with grid id or null if no such turf is found.
|
||||
/// </summary>
|
||||
public static TileRef GetTileRef(this Vector2i vector2i, EntityUid gridId, IMapManager? mapManager = null)
|
||||
public static TileRef GetTileRef(this Vector2i vector2i, EntityUid gridId, IEntityManager? entityManager = null)
|
||||
{
|
||||
mapManager ??= IoCManager.Resolve<IMapManager>();
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||
if (!entityManager.TryGetComponent<MapGridComponent>(gridId, out var grid))
|
||||
return default;
|
||||
|
||||
if (!grid.TryGetTileRef(vector2i, out var tile))
|
||||
@@ -144,9 +145,8 @@ namespace Content.Shared.Maps
|
||||
private static bool GetWorldTileBox(TileRef turf, out Box2Rotated res)
|
||||
{
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var map = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
if (map.TryGetGrid(turf.GridUid, out var tileGrid))
|
||||
if (entManager.TryGetComponent<MapGridComponent>(turf.GridUid, out var tileGrid))
|
||||
{
|
||||
var gridRot = entManager.GetComponent<TransformComponent>(turf.GridUid).WorldRotation;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user