Remove many resolves on Content.Server
This commit is contained in:
@@ -40,7 +40,7 @@ namespace Content.Server.Construction.Completions
|
||||
|
||||
var board = container.ContainedEntities[0];
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(board, out ComputerBoardComponent? boardComponent))
|
||||
if (!entityManager.TryGetComponent(board, out ComputerBoardComponent? boardComponent))
|
||||
{
|
||||
Logger.Warning($"Computer entity {uid} had an invalid entity in container \"{Container}\"! Aborting build computer action.");
|
||||
return;
|
||||
@@ -50,7 +50,7 @@ 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).LocalRotation = transform.LocalRotation;
|
||||
entityManager.GetComponent<TransformComponent>(computer).LocalRotation = transform.LocalRotation;
|
||||
|
||||
var computerContainer = containerSystem.EnsureContainer<Container>(computer, Container);
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Content.Server.Construction.Completions
|
||||
foreach (var ent in computerContainer.ContainedEntities.ToArray())
|
||||
{
|
||||
computerContainer.ForceRemove(ent);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(ent);
|
||||
entityManager.DeleteEntity(ent);
|
||||
}
|
||||
|
||||
computerContainer.Insert(board);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Content.Server.Construction.Completions
|
||||
|
||||
var board = entBoardContainer.ContainedEntities[0];
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(board, out MachineBoardComponent? boardComponent))
|
||||
if (!entityManager.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).LocalRotation = transform.LocalRotation;
|
||||
entityManager.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, out ConstructionComponent? construction))
|
||||
if (entityManager.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, MachineFrameComponent.BoardContainer, construction);
|
||||
constructionSystem.AddContainer(machine, MachineFrameComponent.PartContainer, construction);
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(machine, out MachineComponent? machineComp))
|
||||
if (entityManager.TryGetComponent(machine, out MachineComponent? machineComp))
|
||||
{
|
||||
machineComp.RefreshParts();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Server.Construction.Completions
|
||||
foreach (var contained in container.ContainedEntities.ToArray())
|
||||
{
|
||||
if(container.Remove(contained))
|
||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(contained);
|
||||
entityManager.QueueDeleteEntity(contained);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,9 @@ namespace Content.Server.Construction.Completions
|
||||
foreach (var contained in container.ContainedEntities.ToArray())
|
||||
{
|
||||
container.ForceRemove(contained);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(contained).Coordinates = transform.Coordinates;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(contained).AttachToGridOrMap();
|
||||
var cTransform = entityManager.GetComponent<TransformComponent>(contained);
|
||||
cTransform.Coordinates = transform.Coordinates;
|
||||
cTransform.AttachToGridOrMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Server.Construction.Completions
|
||||
if (EntityPrototypeHelpers.HasComponent<StackComponent>(Prototype))
|
||||
{
|
||||
var stackEnt = entityManager.SpawnEntity(Prototype, coordinates);
|
||||
var stack = IoCManager.Resolve<IEntityManager>().GetComponent<StackComponent>(stackEnt);
|
||||
var stack = entityManager.GetComponent<StackComponent>(stackEnt);
|
||||
entityManager.EntitySysManager.GetEntitySystem<StackSystem>().SetCount(stackEnt, Amount, stack);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user