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

@@ -27,7 +27,7 @@ public sealed partial class ConstructionSystem
}
}
private void OnCompMapInit(EntityUid uid, ComputerComponent component, MapInitEvent args)
private void OnCompMapInit(Entity<ComputerComponent> component, ref MapInitEvent args)
{
CreateComputerBoard(component);
}
@@ -42,25 +42,26 @@ public sealed partial class ConstructionSystem
/// This exists so when you deconstruct computers that were serialized with the map,
/// you can retrieve the computer board.
/// </summary>
private void CreateComputerBoard(ComputerComponent component)
private void CreateComputerBoard(Entity<ComputerComponent> ent)
{
var component = ent.Comp;
// Ensure that the construction component is aware of the board container.
if (TryComp<ConstructionComponent>(component.Owner, out var construction))
AddContainer(component.Owner, "board", construction);
if (TryComp<ConstructionComponent>(ent, out var construction))
AddContainer(ent, "board", construction);
// We don't do anything if this is null or empty.
if (string.IsNullOrEmpty(component.BoardPrototype))
return;
var container = _container.EnsureContainer<Container>(component.Owner, "board");
var container = _container.EnsureContainer<Container>(ent, "board");
// We already contain a board. Note: We don't check if it's the right one!
if (container.ContainedEntities.Count != 0)
return;
var board = EntityManager.SpawnEntity(component.BoardPrototype, Transform(component.Owner).Coordinates);
var board = EntityManager.SpawnEntity(component.BoardPrototype, Transform(ent).Coordinates);
if(!container.Insert(board))
Logger.Warning($"Couldn't insert board {board} to computer {component.Owner}!");
if (!container.Insert(board))
Log.Warning($"Couldn't insert board {board} to computer {ent}!");
}
}