Remove 700 usages of Component.Owner (#21100)
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Shared.Shuttles.BUIStates;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
|
||||
@@ -43,6 +44,8 @@ public class DockingControl : Control
|
||||
/// </summary>
|
||||
public Dictionary<NetEntity, List<DockingInterfaceState>> Docks = new();
|
||||
|
||||
private List<Entity<MapGridComponent>> _grids = new();
|
||||
|
||||
public DockingControl()
|
||||
{
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
@@ -147,17 +150,19 @@ public class DockingControl : Control
|
||||
// TODO: Getting some overdraw so need to fix that.
|
||||
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
|
||||
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(gridXform.MapID,
|
||||
new Box2(worldPos - RangeVector, worldPos + RangeVector)))
|
||||
_grids.Clear();
|
||||
_mapManager.FindGridsIntersecting(gridXform.MapID, new Box2(worldPos - RangeVector, worldPos + RangeVector));
|
||||
|
||||
foreach (var grid in _grids)
|
||||
{
|
||||
if (grid.Owner == GridEntity)
|
||||
continue;
|
||||
|
||||
// Draw the fixtures before drawing any docks in range.
|
||||
if (!_entManager.TryGetComponent<FixturesComponent>(grid.Owner, out var gridFixtures))
|
||||
if (!_entManager.TryGetComponent<FixturesComponent>(grid, out var gridFixtures))
|
||||
continue;
|
||||
|
||||
var gridMatrix = xformQuery.GetComponent(grid.Owner).WorldMatrix;
|
||||
var gridMatrix = xformQuery.GetComponent(grid).WorldMatrix;
|
||||
|
||||
Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty);
|
||||
|
||||
@@ -204,7 +209,7 @@ public class DockingControl : Control
|
||||
}
|
||||
|
||||
// Draw any docks on that grid
|
||||
if (Docks.TryGetValue(_entManager.GetNetEntity(grid.Owner), out var gridDocks))
|
||||
if (Docks.TryGetValue(_entManager.GetNetEntity(grid), out var gridDocks))
|
||||
{
|
||||
foreach (var dock in gridDocks)
|
||||
{
|
||||
|
||||
@@ -3,9 +3,7 @@ using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared.Shuttles.BUIStates;
|
||||
using Content.Shared.Shuttles.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Content.Shared.Shuttles.Systems;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Collections;
|
||||
@@ -13,7 +11,6 @@ using Robust.Shared.Input;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -57,6 +54,8 @@ public sealed class RadarControl : MapGridControl
|
||||
/// </summary>
|
||||
public Action<EntityCoordinates>? OnRadarClick;
|
||||
|
||||
private List<Entity<MapGridComponent>> _grids = new();
|
||||
|
||||
public RadarControl() : base(64f, 256f, 256f)
|
||||
{
|
||||
_transform = _entManager.System<SharedTransformSystem>();
|
||||
@@ -198,9 +197,11 @@ public sealed class RadarControl : MapGridControl
|
||||
|
||||
var shown = new HashSet<EntityUid>();
|
||||
|
||||
_grids.Clear();
|
||||
_mapManager.FindGridsIntersecting(xform.MapID, new Box2(pos - MaxRadarRangeVector, pos + MaxRadarRangeVector), ref _grids);
|
||||
|
||||
// Draw other grids... differently
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(xform.MapID,
|
||||
new Box2(pos - MaxRadarRangeVector, pos + MaxRadarRangeVector)))
|
||||
foreach (var grid in _grids)
|
||||
{
|
||||
var gUid = grid.Owner;
|
||||
if (gUid == ourGridId || !fixturesQuery.HasComponent(gUid))
|
||||
@@ -240,7 +241,7 @@ public sealed class RadarControl : MapGridControl
|
||||
(iff == null && IFFComponent.ShowIFFDefault ||
|
||||
(iff.Flags & IFFFlags.HideLabel) == 0x0))
|
||||
{
|
||||
var gridBounds = grid.LocalAABB;
|
||||
var gridBounds = grid.Comp.LocalAABB;
|
||||
Label label;
|
||||
|
||||
if (!_iffControls.TryGetValue(gUid, out var control))
|
||||
|
||||
Reference in New Issue
Block a user