Adds integration tests to construction, fixes some wrong stack prototypes in construction graphs
🆑
- fix: Fixes a bug where many constructions failed due to a recent material refactor.
This commit is contained in:
@@ -0,0 +1,108 @@
|
|||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Content.Server.Construction.Completions;
|
||||||
|
using Content.Shared.Construction;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
|
namespace Content.IntegrationTests.Tests.Construction
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class ConstructionActionValid : ContentIntegrationTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public async Task ConstructionGraphSpawnPrototypeValid()
|
||||||
|
{
|
||||||
|
var server = StartServerDummyTicker();
|
||||||
|
|
||||||
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
var protoMan = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
|
||||||
|
var valid = true;
|
||||||
|
var message = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (var graph in protoMan.EnumeratePrototypes<ConstructionGraphPrototype>())
|
||||||
|
{
|
||||||
|
foreach (var (_, node) in graph.Nodes)
|
||||||
|
{
|
||||||
|
foreach (var action in node.Actions)
|
||||||
|
{
|
||||||
|
if (action is not SpawnPrototype spawn || protoMan.TryIndex(spawn.Prototype, out EntityPrototype _)) continue;
|
||||||
|
|
||||||
|
valid = false;
|
||||||
|
message.Append($"Invalid entity prototype \"{spawn.Prototype}\" on graph action in node \"{node.Name}\" of graph \"{graph.ID}\"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var edge in node.Edges)
|
||||||
|
{
|
||||||
|
foreach (var action in edge.Completed)
|
||||||
|
{
|
||||||
|
if (action is not SpawnPrototype spawn || protoMan.TryIndex(spawn.Prototype, out EntityPrototype _)) continue;
|
||||||
|
|
||||||
|
valid = false;
|
||||||
|
message.Append($"Invalid entity prototype \"{spawn.Prototype}\" on graph action in edge \"{edge.Target}\" of node \"{node.Name}\" of graph \"{graph.ID}\"\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.That(valid, Is.True, $"One or more SpawnPrototype actions specified invalid entity prototypes!\n{message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task ConstructionGraphNodeEntityPrototypeValid()
|
||||||
|
{
|
||||||
|
var server = StartServerDummyTicker();
|
||||||
|
|
||||||
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
var protoMan = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
|
||||||
|
var valid = true;
|
||||||
|
var message = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (var graph in protoMan.EnumeratePrototypes<ConstructionGraphPrototype>())
|
||||||
|
{
|
||||||
|
foreach (var (_, node) in graph.Nodes)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(node.Entity) || protoMan.TryIndex(node.Entity, out EntityPrototype _)) continue;
|
||||||
|
|
||||||
|
valid = false;
|
||||||
|
message.Append($"Invalid entity prototype \"{node.Entity}\" on node \"{node.Name}\" of graph \"{graph.ID}\"\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.That(valid, Is.True, $"One or more nodes specified invalid entity prototypes!\n{message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task ConstructionGraphEdgeValid()
|
||||||
|
{
|
||||||
|
var server = StartServerDummyTicker();
|
||||||
|
|
||||||
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
var protoMan = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
|
||||||
|
var valid = true;
|
||||||
|
var message = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (var graph in protoMan.EnumeratePrototypes<ConstructionGraphPrototype>())
|
||||||
|
{
|
||||||
|
foreach (var (_, node) in graph.Nodes)
|
||||||
|
{
|
||||||
|
foreach (var edge in node.Edges)
|
||||||
|
{
|
||||||
|
if (graph.Nodes.ContainsKey(edge.Target)) continue;
|
||||||
|
|
||||||
|
valid = false;
|
||||||
|
message.Append($"Invalid target \"{edge.Target}\" in edge on node \"{node.Name}\" of graph \"{graph.ID}\"\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.That(valid, Is.True, $"One or more edges specified invalid node targets!\n{message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Objects/Materials/sheets.rsi
|
sprite: Objects/Materials/sheets.rsi
|
||||||
state: metal
|
state: metal
|
||||||
result: SteelSheet1
|
result: SheetSteel1
|
||||||
completetime: 500
|
completetime: 500
|
||||||
materials:
|
materials:
|
||||||
steel: 100
|
steel: 100
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Objects/Materials/sheets.rsi
|
sprite: Objects/Materials/sheets.rsi
|
||||||
state: glass
|
state: glass
|
||||||
result: GlassSheet1
|
result: SheetGlass1
|
||||||
completetime: 500
|
completetime: 500
|
||||||
materials:
|
materials:
|
||||||
glass: 100
|
glass: 100
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
sound: /Audio/Effects/metalbreak.ogg
|
sound: /Audio/Effects/metalbreak.ogg
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
sound: /Audio/Effects/metalbreak.ogg
|
sound: /Audio/Effects/metalbreak.ogg
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
sound: /Audio/Effects/metalbreak.ogg
|
sound: /Audio/Effects/metalbreak.ogg
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
sound: /Audio/Effects/metalbreak.ogg
|
sound: /Audio/Effects/metalbreak.ogg
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
sound: /Audio/Effects/metalbreak.ogg
|
sound: /Audio/Effects/metalbreak.ogg
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
sound: /Audio/Effects/metalbreak.ogg
|
sound: /Audio/Effects/metalbreak.ogg
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
sound: /Audio/Effects/metalbreak.ogg
|
sound: /Audio/Effects/metalbreak.ogg
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
behaviors:
|
behaviors:
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
behaviors:
|
behaviors:
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 2
|
max: 2
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
behaviors:
|
behaviors:
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
behaviors:
|
behaviors:
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
- !type:EmptyAllContainersBehaviour
|
- !type:EmptyAllContainersBehaviour
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 2
|
min: 2
|
||||||
max: 2
|
max: 2
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
- !type:EmptyAllContainersBehaviour
|
- !type:EmptyAllContainersBehaviour
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
|
|||||||
@@ -144,7 +144,7 @@
|
|||||||
sound: /Audio/Effects/metalbreak.ogg
|
sound: /Audio/Effects/metalbreak.ogg
|
||||||
- !type:SpawnEntitiesBehavior
|
- !type:SpawnEntitiesBehavior
|
||||||
spawn:
|
spawn:
|
||||||
SteelSheet1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
anchored: false
|
anchored: false
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
amount: 5
|
amount: 5
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
steps:
|
steps:
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
- !type:EntityAnchored { }
|
- !type:EntityAnchored { }
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: GlassSheet1
|
prototype: SheetGlass1
|
||||||
amount: 2
|
amount: 2
|
||||||
steps:
|
steps:
|
||||||
- tool: Prying
|
- tool: Prying
|
||||||
@@ -144,8 +144,8 @@
|
|||||||
- !type:EntityAnchored {}
|
- !type:EntityAnchored {}
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: GlassSheet1 # TODO: Replace with glass shard.
|
prototype: ShardBase
|
||||||
amount: 1
|
amount: 2
|
||||||
steps:
|
steps:
|
||||||
- tool: Prying
|
- tool: Prying
|
||||||
doAfter: 2
|
doAfter: 2
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
- node: start
|
- node: start
|
||||||
actions:
|
actions:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
amount: 2
|
amount: 2
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
edges:
|
edges:
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
- to: start
|
- to: start
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
amount: 3
|
amount: 3
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
conditions:
|
conditions:
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
- to: frame4
|
- to: frame4
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: GlassSheet1
|
prototype: SheetGlass1
|
||||||
amount: 2
|
amount: 2
|
||||||
steps:
|
steps:
|
||||||
- tool: Screwing
|
- tool: Screwing
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
- to: start
|
- to: start
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
amount: 2
|
amount: 2
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
conditions:
|
conditions:
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
- to: girder
|
- to: girder
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
amount: 2
|
amount: 2
|
||||||
steps:
|
steps:
|
||||||
- tool: Welding
|
- tool: Welding
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
doAfter: 2.0
|
doAfter: 2.0
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
amount: 2
|
amount: 2
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
- node: bulbLight
|
- node: bulbLight
|
||||||
@@ -41,6 +41,6 @@
|
|||||||
doAfter: 2.0
|
doAfter: 2.0
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
amount: 1
|
amount: 1
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
component: Window
|
component: Window
|
||||||
actions:
|
actions:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
amount: 3
|
amount: 3
|
||||||
- !type:DeleteEntity { }
|
- !type:DeleteEntity { }
|
||||||
edges:
|
edges:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
- node: start
|
- node: start
|
||||||
actions:
|
actions:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
edges:
|
edges:
|
||||||
- to: missingWires
|
- to: missingWires
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
anchored: false
|
anchored: false
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
amount: 5
|
amount: 5
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
- to: start
|
- to: start
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SteelSheet1
|
prototype: SheetSteel1
|
||||||
amount: 5
|
amount: 5
|
||||||
- !type:EmptyAllContainers {}
|
- !type:EmptyAllContainers {}
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
- to: start
|
- to: start
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: GlassSheet1
|
prototype: SheetGlass1
|
||||||
amount: 2
|
amount: 2
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
steps:
|
steps:
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
- to: start
|
- to: start
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: RGlassSheet1
|
prototype: SheetRGlass1
|
||||||
amount: 2
|
amount: 2
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
steps:
|
steps:
|
||||||
@@ -67,13 +67,13 @@
|
|||||||
- to: start
|
- to: start
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: GlassSheet1
|
prototype: SheetGlass1
|
||||||
amount: 2
|
amount: 2
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: MetalSheet1
|
prototype: SheetSteel1
|
||||||
amount: 2
|
amount: 2
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: PlasmaSheet1
|
prototype: SheetPlasma1
|
||||||
amount: 2
|
amount: 2
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity {}
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
Reference in New Issue
Block a user