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

@@ -4,10 +4,12 @@ using Content.Shared.Atmos;
using Content.Shared.Atmos.EntitySystems;
using Content.Shared.CCVar;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.EntitySystems
{
@@ -18,6 +20,7 @@ namespace Content.Server.Atmos.EntitySystems
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly MapSystem _mapSystem = default!;
/// <summary>
/// Players allowed to see the atmos debug overlay.
@@ -31,6 +34,8 @@ namespace Content.Server.Atmos.EntitySystems
/// </summary>
private float _updateCooldown;
private List<Entity<MapGridComponent>> _grids = new();
public override void Initialize()
{
base.Initialize();
@@ -137,7 +142,10 @@ namespace Content.Server.Atmos.EntitySystems
var worldBounds = Box2.CenteredAround(transform.WorldPosition,
new Vector2(LocalViewRange, LocalViewRange));
foreach (var grid in _mapManager.FindGridsIntersecting(transform.MapID, worldBounds))
_grids.Clear();
_mapManager.FindGridsIntersecting(transform.MapID, worldBounds, ref _grids);
foreach (var grid in _grids)
{
var uid = grid.Owner;
@@ -147,7 +155,7 @@ namespace Content.Server.Atmos.EntitySystems
if (!TryComp(uid, out GridAtmosphereComponent? gridAtmos))
continue;
var entityTile = grid.GetTileRef(transform.Coordinates).GridIndices;
var entityTile = _mapSystem.GetTileRef(grid, grid, transform.Coordinates).GridIndices;
var baseTile = new Vector2i(entityTile.X - (LocalViewRange / 2), entityTile.Y - (LocalViewRange / 2));
var debugOverlayContent = new AtmosDebugOverlayData[LocalViewRange * LocalViewRange];
@@ -161,7 +169,7 @@ namespace Content.Server.Atmos.EntitySystems
}
}
RaiseNetworkEvent(new AtmosDebugOverlayMessage(GetNetEntity(grid.Owner), baseTile, debugOverlayContent), session.ConnectedClient);
RaiseNetworkEvent(new AtmosDebugOverlayMessage(GetNetEntity(grid), baseTile, debugOverlayContent), session.ConnectedClient);
}
}
}