Code Cleanup: Purge obsolete MapManager methods (#26279)

* GetGrid

* GridExists

* TryGetGrid
This commit is contained in:
Tayrtahn
2024-03-22 03:08:40 -04:00
committed by GitHub
parent 2ed0e58069
commit ae3d745430
49 changed files with 97 additions and 122 deletions

View File

@@ -3,7 +3,7 @@ using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration;
using Content.Shared.Atmos;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.Commands
{
@@ -11,7 +11,6 @@ namespace Content.Server.Atmos.Commands
public sealed class DeleteGasCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
public string Command => "deletegas";
public string Description => "Removes all gases from a grid, or just of one type if specified.";
@@ -119,7 +118,7 @@ namespace Content.Server.Atmos.Commands
return;
}
if (!_mapManager.TryGetGrid(gridId, out _))
if (!_entManager.TryGetComponent<MapGridComponent>(gridId, out _))
{
shell.WriteLine($"No grid exists with id {gridId}");
return;

View File

@@ -3,14 +3,12 @@ using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.Piping.EntitySystems;
public sealed class AtmosPipeAppearanceSystem : EntitySystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize()
@@ -31,7 +29,7 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem
if (!Resolve(uid, ref appearance, ref container, ref xform, false))
return;
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
if (!TryComp<MapGridComponent>(xform.GridUid, out var grid))
return;
// get connected entities

View File

@@ -7,15 +7,14 @@ using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.Construction.Components;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
{
[UsedImplicitly]
public sealed class GasPortableSystem : EntitySystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
@@ -58,7 +57,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
{
port = null;
if (!_mapManager.TryGetGrid(gridId, out var grid))
if (!TryComp<MapGridComponent>(gridId, out var grid))
return false;
foreach (var entityUid in grid.GetLocal(coordinates))