Removes prototype construction steps (I HATE PROTOTYPE STEPS) (#11611)
This commit is contained in:
@@ -112,48 +112,5 @@ namespace Content.IntegrationTests.Tests.Construction
|
||||
}
|
||||
await pairTracker.CleanReturnAsync();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestStackPrototypeSteps()
|
||||
{
|
||||
// People often mistakenly use the prototype-step rather than a material-step, resulting in a whole stack
|
||||
// being consumed. This checks that if something uses a prototype step, that the relevant prototype does not
|
||||
// have a stack component.
|
||||
//
|
||||
// If, for whatever reason, that is ever required, then this test should probably just support an ignore
|
||||
// list. Though the test should then also checks that it accepts both the full-stack and single-sheet
|
||||
// prototypes.
|
||||
|
||||
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
|
||||
var server = pairTracker.Pair.Server;
|
||||
var protoMan = server.ResolveDependency<IPrototypeManager>();
|
||||
var stackName = server.ResolveDependency<IComponentFactory>().GetComponentName(typeof(StackComponent));
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
// quadruple for loop nesting, what fun.
|
||||
foreach (var protoGraph in protoMan.EnumeratePrototypes<ConstructionGraphPrototype>())
|
||||
{
|
||||
foreach (var node in protoGraph.Nodes.Values)
|
||||
{
|
||||
foreach (var edge in node.Edges)
|
||||
{
|
||||
foreach (var step in edge.Steps)
|
||||
{
|
||||
if (step is not PrototypeConstructionGraphStep protoStep)
|
||||
continue;
|
||||
|
||||
var protoEnt = protoMan.Index<EntityPrototype>(protoStep.Prototype);
|
||||
|
||||
Assert.False(protoEnt.Components.ContainsKey(stackName),
|
||||
$"Construction graph {protoGraph.ID} uses a prototype-step that consumes a stackable entity {protoEnt.ID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
await pairTracker.CleanReturnAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user