Remove 700 usages of Component.Owner (#21100)
This commit is contained in:
@@ -7,9 +7,9 @@ using Robust.Client.Graphics;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.Utility;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Graphics;
|
||||
using Robust.Shared.Graphics.RSI;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -99,13 +99,17 @@ public sealed class WeatherOverlay : Overlay
|
||||
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
|
||||
var weatherIgnoreQuery = _entManager.GetEntityQuery<IgnoreWeatherComponent>();
|
||||
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(mapId, worldAABB))
|
||||
// idk if this is safe to cache in a field and clear sloth help
|
||||
var grids = new List<Entity<MapGridComponent>>();
|
||||
_mapManager.FindGridsIntersecting(mapId, worldAABB, ref grids);
|
||||
|
||||
foreach (var grid in grids)
|
||||
{
|
||||
var matrix = _transform.GetWorldMatrix(grid.Owner, xformQuery);
|
||||
var matrix = _transform.GetWorldMatrix(grid, xformQuery);
|
||||
Matrix3.Multiply(in matrix, in invMatrix, out var matty);
|
||||
worldHandle.SetTransform(matty);
|
||||
|
||||
foreach (var tile in grid.GetTilesIntersecting(worldAABB))
|
||||
foreach (var tile in grid.Comp.GetTilesIntersecting(worldAABB))
|
||||
{
|
||||
// Ignored tiles for stencil
|
||||
if (_weather.CanWeatherAffect(grid, tile, weatherIgnoreQuery, bodyQuery))
|
||||
@@ -113,8 +117,8 @@ public sealed class WeatherOverlay : Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
var gridTile = new Box2(tile.GridIndices * grid.TileSize,
|
||||
(tile.GridIndices + Vector2i.One) * grid.TileSize);
|
||||
var gridTile = new Box2(tile.GridIndices * grid.Comp.TileSize,
|
||||
(tile.GridIndices + Vector2i.One) * grid.Comp.TileSize);
|
||||
|
||||
worldHandle.DrawRect(gridTile, Color.White);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
||||
[Dependency] private readonly IOverlayManager _overlayManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly AudioSystem _audio = default!;
|
||||
[Dependency] private readonly MapSystem _mapSystem = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
@@ -76,8 +77,9 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
||||
// Work out tiles nearby to determine volume.
|
||||
if (TryComp<MapGridComponent>(entXform.GridUid, out var grid))
|
||||
{
|
||||
var gridId = entXform.GridUid.Value;
|
||||
// Floodfill to the nearest tile and use that for audio.
|
||||
var seed = grid.GetTileRef(entXform.Coordinates);
|
||||
var seed = _mapSystem.GetTileRef(gridId, grid, entXform.Coordinates);
|
||||
var frontier = new Queue<TileRef>();
|
||||
frontier.Enqueue(seed);
|
||||
// If we don't have a nearest node don't play any sound.
|
||||
@@ -107,7 +109,7 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
||||
continue;
|
||||
}
|
||||
|
||||
frontier.Enqueue(grid.GetTileRef(new Vector2i(x, y) + node.GridIndices));
|
||||
frontier.Enqueue(_mapSystem.GetTileRef(gridId, grid, new Vector2i(x, y) + node.GridIndices));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user