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,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 FillGas : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
public string Command => "fillgas";
public string Description => "Adds gas to all tiles in a grid.";
@@ -30,7 +29,7 @@ namespace Content.Server.Atmos.Commands
return;
}
if (!_mapManager.TryGetGrid(gridId, out var grid))
if (!_entManager.HasComponent<MapGridComponent>(gridId))
{
shell.WriteLine("Invalid grid ID.");
return;
@@ -38,7 +37,7 @@ namespace Content.Server.Atmos.Commands
var atmosphereSystem = _entManager.System<AtmosphereSystem>();
foreach (var tile in atmosphereSystem.GetAllMixtures(grid.Owner, true))
foreach (var tile in atmosphereSystem.GetAllMixtures(gridId.Value, true))
{
tile.AdjustMoles(gasId, moles);
}

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 SetAtmosTemperatureCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
public string Command => "setatmostemp";
public string Description => "Sets a grid's temperature (in kelvin).";
@@ -34,7 +33,7 @@ namespace Content.Server.Atmos.Commands
return;
}
if (!gridId.Value.IsValid() || !_mapManager.TryGetGrid(gridId, out var gridComp))
if (!gridId.Value.IsValid() || !_entManager.HasComponent<MapGridComponent>(gridId))
{
shell.WriteLine("Invalid grid ID.");
return;
@@ -43,7 +42,7 @@ namespace Content.Server.Atmos.Commands
var atmosphereSystem = _entManager.System<AtmosphereSystem>();
var tiles = 0;
foreach (var tile in atmosphereSystem.GetAllMixtures(gridComp.Owner, true))
foreach (var tile in atmosphereSystem.GetAllMixtures(gridId.Value, true))
{
tiles++;
tile.Temperature = temperature;

View File

@@ -2,11 +2,8 @@ using Content.Server.Administration;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration;
using Content.Shared.Atmos;
using Robust.Server.GameObjects;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.Commands
{
@@ -14,7 +11,6 @@ namespace Content.Server.Atmos.Commands
public sealed class SetTemperatureCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
public string Command => "settemp";
public string Description => "Sets a tile's temperature (in kelvin).";
@@ -40,7 +36,7 @@ namespace Content.Server.Atmos.Commands
return;
}
if (!_mapManager.TryGetGrid(gridId, out var grid))
if (!_entities.HasComponent<MapGridComponent>(gridId))
{
shell.WriteError("Invalid grid.");
return;
@@ -49,7 +45,7 @@ namespace Content.Server.Atmos.Commands
var atmospheres = _entities.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
var indices = new Vector2i(x, y);
var tile = atmospheres.GetTileMixture(grid.Owner, null, indices, true);
var tile = atmospheres.GetTileMixture(gridId, null, indices, true);
if (tile == null)
{