Inline TryGetComponent completely, for real
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Shared.Construction;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
@@ -53,7 +54,7 @@ namespace Content.Server.Construction.Completions
|
||||
|
||||
var board = entBoardContainer.ContainedEntities[0];
|
||||
|
||||
if (!board.TryGetComponent(out MachineBoardComponent? boardComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(board.Uid, out MachineBoardComponent? boardComponent))
|
||||
{
|
||||
Logger.Warning($"Machine frame entity {uid} had an invalid entity in container \"{MachineFrameComponent.BoardContainer}\"! Aborting build machine action.");
|
||||
return;
|
||||
@@ -91,14 +92,14 @@ namespace Content.Server.Construction.Completions
|
||||
}
|
||||
|
||||
var constructionSystem = entityManager.EntitySysManager.GetEntitySystem<ConstructionSystem>();
|
||||
if (machine.TryGetComponent(out ConstructionComponent? construction))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(machine.Uid, 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);
|
||||
}
|
||||
|
||||
if (machine.TryGetComponent(out MachineComponent? machineComp))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(machine.Uid, out MachineComponent? machineComp))
|
||||
{
|
||||
machineComp.RefreshParts();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user