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

@@ -7,6 +7,7 @@ using Content.Shared.Doors;
using Content.Shared.Doors.Components;
using Content.Shared.Shuttles.Events;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Physics.Components;
@@ -66,7 +67,7 @@ namespace Content.Server.Shuttles.Systems
args.Cancel();
}
private DockingComponent? GetDockable(EntityUid uid, TransformComponent dockingXform)
private Entity<DockingComponent>? GetDockable(EntityUid uid, TransformComponent dockingXform)
{
// Did you know Saltern is the most dockable station?
@@ -96,12 +97,14 @@ namespace Content.Server.Shuttles.Systems
var enlargedAABB = aabb.Value.Enlarged(DockingRadius * 1.5f);
// Get any docking ports in range on other grids.
foreach (var otherGrid in _mapManager.FindGridsIntersecting(dockingXform.MapID, enlargedAABB))
var grids = new List<Entity<MapGridComponent>>();
_mapManager.FindGridsIntersecting(dockingXform.MapID, enlargedAABB, ref grids);
foreach (var otherGrid in grids)
{
if (otherGrid.Owner == dockingXform.GridUid)
continue;
foreach (var ent in otherGrid.GetAnchoredEntities(enlargedAABB))
foreach (var ent in otherGrid.Comp.GetAnchoredEntities(enlargedAABB))
{
if (!TryComp(ent, out DockingComponent? otherDocking) ||
!otherDocking.Enabled ||
@@ -129,7 +132,7 @@ namespace Content.Server.Shuttles.Systems
// TODO: Need CollisionManager's GJK for accurate bounds
// Realistically I want 2 fixtures anyway but I'll deal with that later.
return otherDocking;
return (ent, otherDocking);
}
}
}
@@ -443,12 +446,12 @@ namespace Content.Server.Shuttles.Systems
/// <summary>
/// Attempts to dock 2 ports together and will return early if it's not possible.
/// </summary>
private void TryDock(EntityUid dockAUid, DockingComponent dockA, EntityUid dockBUid, DockingComponent dockB)
private void TryDock(EntityUid dockAUid, DockingComponent dockA, Entity<DockingComponent> dockB)
{
if (!CanDock(dockAUid, dockBUid, dockA, dockB))
if (!CanDock(dockAUid, dockB, dockA, dockB))
return;
Dock(dockAUid, dockA, dockBUid, dockB);
Dock(dockAUid, dockA, dockB, dockB);
}
public void Undock(EntityUid dockUid, DockingComponent dock)