Inline UID

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 15:53:09 +01:00
parent 2654775bf0
commit 5cd42c9ad6
803 changed files with 3613 additions and 3577 deletions

View File

@@ -41,7 +41,7 @@ namespace Content.Server.Construction.Completions
var board = container.ContainedEntities[0];
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(board.Uid, out ComputerBoardComponent? boardComponent))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(board, out ComputerBoardComponent? boardComponent))
{
Logger.Warning($"Computer entity {uid} had an invalid entity in container \"{Container}\"! Aborting build computer action.");
return;
@@ -51,21 +51,21 @@ namespace Content.Server.Construction.Completions
var transform = entityManager.GetComponent<TransformComponent>(uid);
var computer = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates);
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(computer.Uid).LocalRotation = transform.LocalRotation;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(computer).LocalRotation = transform.LocalRotation;
var computerContainer = containerSystem.EnsureContainer<Container>(computer.Uid, Container);
var computerContainer = containerSystem.EnsureContainer<Container>(computer, Container);
// In case it already existed and there are any entities inside the container, delete them.
foreach (var ent in computerContainer.ContainedEntities.ToArray())
{
computerContainer.ForceRemove(ent);
IoCManager.Resolve<IEntityManager>().DeleteEntity(ent.Uid);
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) ent);
}
computerContainer.Insert(board);
// We only add this container. If some construction needs to take other containers into account, fix this.
entityManager.EntitySysManager.GetEntitySystem<ConstructionSystem>().AddContainer(computer.Uid, Container);
entityManager.EntitySysManager.GetEntitySystem<ConstructionSystem>().AddContainer(computer, Container);
// Delete the original entity.
entityManager.DeleteEntity(uid);

View File

@@ -54,7 +54,7 @@ namespace Content.Server.Construction.Completions
var board = entBoardContainer.ContainedEntities[0];
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(board.Uid, out MachineBoardComponent? boardComponent))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(board, out MachineBoardComponent? boardComponent))
{
Logger.Warning($"Machine frame entity {uid} had an invalid entity in container \"{MachineFrameComponent.BoardContainer}\"! Aborting build machine action.");
return;
@@ -64,7 +64,7 @@ namespace Content.Server.Construction.Completions
var transform = entityManager.GetComponent<TransformComponent>(uid);
var machine = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates);
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(machine.Uid).LocalRotation = transform.LocalRotation;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(machine).LocalRotation = transform.LocalRotation;
var boardContainer = machine.EnsureContainer<Container>(MachineFrameComponent.BoardContainer, out var existed);
@@ -92,14 +92,14 @@ namespace Content.Server.Construction.Completions
}
var constructionSystem = entityManager.EntitySysManager.GetEntitySystem<ConstructionSystem>();
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(machine.Uid, out ConstructionComponent? construction))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(machine, out ConstructionComponent? construction))
{
// We only add these two container. If some construction needs to take other containers into account, fix this.
constructionSystem.AddContainer(machine.Uid, MachineFrameComponent.BoardContainer, construction);
constructionSystem.AddContainer(machine.Uid, MachineFrameComponent.PartContainer, construction);
constructionSystem.AddContainer(machine, MachineFrameComponent.BoardContainer, construction);
constructionSystem.AddContainer(machine, MachineFrameComponent.PartContainer, construction);
}
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(machine.Uid, out MachineComponent? machineComp))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(machine, out MachineComponent? machineComp))
{
machineComp.RefreshParts();
}

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Construction.Completions
foreach (var contained in container.ContainedEntities.ToArray())
{
if(container.Remove(contained))
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(contained.Uid);
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity((EntityUid) contained);
}
}
}

View File

@@ -25,8 +25,8 @@ namespace Content.Server.Construction.Completions
foreach (var contained in container.ContainedEntities.ToArray())
{
container.ForceRemove(contained);
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(contained.Uid).Coordinates = transform.Coordinates;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(contained.Uid).AttachToGridOrMap();
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(contained).Coordinates = transform.Coordinates;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(contained).AttachToGridOrMap();
}
}
}

View File

@@ -26,8 +26,8 @@ namespace Content.Server.Construction.Completions
if (EntityPrototypeHelpers.HasComponent<StackComponent>(Prototype))
{
var stackEnt = entityManager.SpawnEntity(Prototype, coordinates);
var stack = IoCManager.Resolve<IEntityManager>().GetComponent<StackComponent>(stackEnt.Uid);
entityManager.EntitySysManager.GetEntitySystem<StackSystem>().SetCount(stackEnt.Uid, Amount, stack);
var stack = IoCManager.Resolve<IEntityManager>().GetComponent<StackComponent>(stackEnt);
entityManager.EntitySysManager.GetEntitySystem<StackSystem>().SetCount(stackEnt, Amount, stack);
}
else
{