Remove 700 usages of Component.Owner (#21100)

This commit is contained in:
DrSmugleaf
2023-10-19 12:34:31 -07:00
committed by GitHub
parent 5825ffb95c
commit f560f88eb5
261 changed files with 2291 additions and 2036 deletions

View File

@@ -3,6 +3,7 @@ using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Construction.Commands;
@@ -10,7 +11,6 @@ namespace Content.Server.Construction.Commands;
sealed class TileReplaceCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly ITileDefinitionManager _tileDef = default!;
// ReSharper disable once StringLiteralTypo
@@ -58,13 +58,13 @@ sealed class TileReplaceCommand : IConsoleCommand
var tileA = _tileDef[tileIdA];
var tileB = _tileDef[tileIdB];
if (!_mapManager.TryGetGrid(gridId, out var grid))
if (!_entManager.TryGetComponent(gridId, out MapGridComponent? grid))
{
shell.WriteLine($"No grid exists with id {gridId}");
return;
}
if (!_entManager.EntityExists(grid.Owner))
if (!_entManager.EntityExists(gridId))
{
shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
return;