Inline Prototype
This commit is contained in:
@@ -74,7 +74,7 @@ namespace Content.Server.Construction.Commands
|
||||
continue;
|
||||
}
|
||||
|
||||
var prototype = childEntity.Prototype;
|
||||
var prototype = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(childEntity.Uid).EntityPrototype;
|
||||
while (true)
|
||||
{
|
||||
if (prototype?.Parent == null)
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Stack;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Construction.Components
|
||||
@@ -66,7 +67,7 @@ namespace Content.Server.Construction.Components
|
||||
|
||||
if (!_boardContainer.Insert(board))
|
||||
{
|
||||
throw new Exception($"Couldn't insert board with prototype {BoardPrototype} to machine with prototype {Owner.Prototype?.ID ?? "N/A"}!");
|
||||
throw new Exception($"Couldn't insert board with prototype {BoardPrototype} to machine with prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype?.ID ?? "N/A"}!");
|
||||
}
|
||||
|
||||
if (!board.TryGetComponent<MachineBoardComponent>(out var machineBoard))
|
||||
@@ -81,7 +82,7 @@ namespace Content.Server.Construction.Components
|
||||
var p = entityManager.SpawnEntity(MachinePartComponent.Prototypes[part], Owner.Transform.Coordinates);
|
||||
|
||||
if (!partContainer.Insert(p))
|
||||
throw new Exception($"Couldn't insert machine part of type {part} to machine with prototype {Owner.Prototype?.ID ?? "N/A"}!");
|
||||
throw new Exception($"Couldn't insert machine part of type {part} to machine with prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype?.ID ?? "N/A"}!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +91,7 @@ namespace Content.Server.Construction.Components
|
||||
var stack = EntitySystem.Get<StackSystem>().Spawn(amount, stackType, Owner.Transform.Coordinates);
|
||||
|
||||
if (!partContainer.Insert(IoCManager.Resolve<IEntityManager>().GetEntity(stack)))
|
||||
throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {Owner.Prototype?.ID ?? "N/A"}");
|
||||
throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype?.ID ?? "N/A"}");
|
||||
}
|
||||
|
||||
foreach (var (compName, info) in machineBoard.ComponentRequirements)
|
||||
@@ -100,7 +101,7 @@ namespace Content.Server.Construction.Components
|
||||
var c = entityManager.SpawnEntity(info.DefaultPrototype, Owner.Transform.Coordinates);
|
||||
|
||||
if(!partContainer.Insert(c))
|
||||
throw new Exception($"Couldn't insert machine component part with default prototype '{compName}' to machine with prototype {Owner.Prototype?.ID ?? "N/A"}");
|
||||
throw new Exception($"Couldn't insert machine component part with default prototype '{compName}' to machine with prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype?.ID ?? "N/A"}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ namespace Content.Server.Construction.Components
|
||||
var c = entityManager.SpawnEntity(info.DefaultPrototype, Owner.Transform.Coordinates);
|
||||
|
||||
if(!partContainer.Insert(c))
|
||||
throw new Exception($"Couldn't insert machine component part with default prototype '{tagName}' to machine with prototype {Owner.Prototype?.ID ?? "N/A"}");
|
||||
throw new Exception($"Couldn't insert machine component part with default prototype '{tagName}' to machine with prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype?.ID ?? "N/A"}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,13 +51,13 @@ namespace Content.Server.Construction
|
||||
{
|
||||
if (GetCurrentGraph(uid, construction) is not {} graph)
|
||||
{
|
||||
_sawmill.Warning($"Prototype {construction.Owner.Prototype?.ID}'s construction component has an invalid graph specified.");
|
||||
_sawmill.Warning($"Prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid graph specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetNodeFromGraph(graph, construction.Node) is not {} node)
|
||||
{
|
||||
_sawmill.Warning($"Prototype {construction.Owner.Prototype?.ID}'s construction component has an invalid node specified.");
|
||||
_sawmill.Warning($"Prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid node specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Content.Server.Construction
|
||||
{
|
||||
if (GetEdgeFromNode(node, edgeIndex) is not {} currentEdge)
|
||||
{
|
||||
_sawmill.Warning($"Prototype {construction.Owner.Prototype?.ID}'s construction component has an invalid edge index specified.");
|
||||
_sawmill.Warning($"Prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid edge index specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Content.Server.Construction
|
||||
{
|
||||
if (GetNodeFromGraph(graph, targetNodeId) is not { } targetNode)
|
||||
{
|
||||
_sawmill.Warning($"Prototype {construction.Owner.Prototype?.ID}'s construction component has an invalid target node specified.");
|
||||
_sawmill.Warning($"Prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid target node specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user