diff --git a/Content.IntegrationTests/Tests/Construction/ConstructionActionValid.cs b/Content.IntegrationTests/Tests/Construction/ConstructionActionValid.cs new file mode 100644 index 0000000000..4197effa71 --- /dev/null +++ b/Content.IntegrationTests/Tests/Construction/ConstructionActionValid.cs @@ -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(); + + var valid = true; + var message = new StringBuilder(); + + foreach (var graph in protoMan.EnumeratePrototypes()) + { + 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(); + + var valid = true; + var message = new StringBuilder(); + + foreach (var graph in protoMan.EnumeratePrototypes()) + { + 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(); + + var valid = true; + var message = new StringBuilder(); + + foreach (var graph in protoMan.EnumeratePrototypes()) + { + 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}"); + } + } +} diff --git a/Resources/Prototypes/Catalog/LatheRecipes/sheet.yml b/Resources/Prototypes/Catalog/LatheRecipes/sheet.yml index 40ea4d365e..7de60af797 100644 --- a/Resources/Prototypes/Catalog/LatheRecipes/sheet.yml +++ b/Resources/Prototypes/Catalog/LatheRecipes/sheet.yml @@ -3,7 +3,7 @@ icon: sprite: Objects/Materials/sheets.rsi state: metal - result: SteelSheet1 + result: SheetSteel1 completetime: 500 materials: steel: 100 @@ -13,7 +13,7 @@ icon: sprite: Objects/Materials/sheets.rsi state: glass - result: GlassSheet1 + result: SheetGlass1 completetime: 500 materials: glass: 100 diff --git a/Resources/Prototypes/Entities/Constructible/Furniture/storage.yml b/Resources/Prototypes/Entities/Constructible/Furniture/storage.yml index e9393965c6..0f85babc84 100644 --- a/Resources/Prototypes/Entities/Constructible/Furniture/storage.yml +++ b/Resources/Prototypes/Entities/Constructible/Furniture/storage.yml @@ -41,7 +41,7 @@ sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior @@ -90,7 +90,7 @@ sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml b/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml index 709d3bc5bf..1ad9f0516a 100644 --- a/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml +++ b/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml @@ -48,7 +48,7 @@ sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior @@ -76,7 +76,7 @@ sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior @@ -107,7 +107,7 @@ sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior @@ -135,7 +135,7 @@ sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior @@ -166,7 +166,7 @@ sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/controller.yml b/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/controller.yml index 0ea7929908..817af3334d 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/controller.yml +++ b/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/controller.yml @@ -32,7 +32,7 @@ behaviors: - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/shielding.yml b/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/shielding.yml index ffc4e283e1..69bfe9c33b 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/shielding.yml +++ b/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/shielding.yml @@ -31,7 +31,7 @@ behaviors: - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 2 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Entities/Constructible/Specific/chem_master.yml b/Resources/Prototypes/Entities/Constructible/Specific/chem_master.yml index 8e988a16cf..d5a3ab9c46 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/chem_master.yml +++ b/Resources/Prototypes/Entities/Constructible/Specific/chem_master.yml @@ -94,7 +94,7 @@ behaviors: - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Entities/Constructible/Walls/girder.yml b/Resources/Prototypes/Entities/Constructible/Walls/girder.yml index f481dc30f9..2dda7e09e4 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/girder.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/girder.yml @@ -39,7 +39,7 @@ behaviors: - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Entities/Constructible/Walls/lighting.yml b/Resources/Prototypes/Entities/Constructible/Walls/lighting.yml index b7c4d7d2d7..92ee1b8072 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/lighting.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/lighting.yml @@ -38,7 +38,7 @@ - !type:EmptyAllContainersBehaviour - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 2 max: 2 - !type:DoActsBehavior @@ -100,7 +100,7 @@ - !type:EmptyAllContainersBehaviour - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml b/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml index 8a33d0409f..81b3b2c0c5 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml @@ -144,7 +144,7 @@ sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior spawn: - SteelSheet1: + SheetSteel1: min: 1 max: 1 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/computer.yml b/Resources/Prototypes/Recipes/Construction/Graphs/computer.yml index c654c6d87b..521871886d 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/computer.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/computer.yml @@ -35,7 +35,7 @@ anchored: false completed: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 amount: 5 - !type:DeleteEntity {} steps: @@ -125,7 +125,7 @@ - !type:EntityAnchored { } completed: - !type:SpawnPrototype - prototype: GlassSheet1 + prototype: SheetGlass1 amount: 2 steps: - tool: Prying @@ -144,8 +144,8 @@ - !type:EntityAnchored {} completed: - !type:SpawnPrototype - prototype: GlassSheet1 # TODO: Replace with glass shard. - amount: 1 + prototype: ShardBase + amount: 2 steps: - tool: Prying doAfter: 2 diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/conveyor.yml b/Resources/Prototypes/Recipes/Construction/Graphs/conveyor.yml index 3a7ee3c6ec..f39bdaad21 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/conveyor.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/conveyor.yml @@ -37,7 +37,7 @@ - node: start actions: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 amount: 2 - !type:DeleteEntity {} edges: diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/firelock.yml b/Resources/Prototypes/Recipes/Construction/Graphs/firelock.yml index f7ec7d64df..cf2fa03416 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/firelock.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/firelock.yml @@ -30,7 +30,7 @@ - to: start completed: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 amount: 3 - !type:DeleteEntity {} conditions: @@ -146,7 +146,7 @@ - to: frame4 completed: - !type:SpawnPrototype - prototype: GlassSheet1 + prototype: SheetGlass1 amount: 2 steps: - tool: Screwing diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/girder.yml b/Resources/Prototypes/Recipes/Construction/Graphs/girder.yml index 8eba148d1a..0a6acb9311 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/girder.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/girder.yml @@ -24,7 +24,7 @@ - to: start completed: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 amount: 2 - !type:DeleteEntity {} conditions: @@ -60,7 +60,7 @@ - to: girder completed: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 amount: 2 steps: - tool: Welding diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/lighting.yml b/Resources/Prototypes/Recipes/Construction/Graphs/lighting.yml index e7c45c4331..6b8b75fcc2 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/lighting.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/lighting.yml @@ -26,7 +26,7 @@ doAfter: 2.0 completed: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 amount: 2 - !type:DeleteEntity {} - node: bulbLight @@ -41,6 +41,6 @@ doAfter: 2.0 completed: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 amount: 1 - !type:DeleteEntity {} diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/low_wall.yml b/Resources/Prototypes/Recipes/Construction/Graphs/low_wall.yml index 9f078dca19..3926d23f98 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/low_wall.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/low_wall.yml @@ -9,7 +9,7 @@ component: Window actions: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 amount: 3 - !type:DeleteEntity { } edges: diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/machine.yml b/Resources/Prototypes/Recipes/Construction/Graphs/machine.yml index 64c6e10ce3..916d48ad17 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/machine.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/machine.yml @@ -5,7 +5,7 @@ - node: start actions: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 - !type:DeleteEntity {} edges: - to: missingWires @@ -35,7 +35,7 @@ anchored: false completed: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 amount: 5 - !type:DeleteEntity {} steps: diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/toilet.yml b/Resources/Prototypes/Recipes/Construction/Graphs/toilet.yml index 619ba1953f..1e9b4e70f0 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/toilet.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/toilet.yml @@ -16,7 +16,7 @@ - to: start completed: - !type:SpawnPrototype - prototype: SteelSheet1 + prototype: SheetSteel1 amount: 5 - !type:EmptyAllContainers {} - !type:DeleteEntity {} diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/window.yml b/Resources/Prototypes/Recipes/Construction/Graphs/window.yml index c398aef9d2..0dfb59aab3 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/window.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/window.yml @@ -33,7 +33,7 @@ - to: start completed: - !type:SpawnPrototype - prototype: GlassSheet1 + prototype: SheetGlass1 amount: 2 - !type:DeleteEntity {} steps: @@ -48,7 +48,7 @@ - to: start completed: - !type:SpawnPrototype - prototype: RGlassSheet1 + prototype: SheetRGlass1 amount: 2 - !type:DeleteEntity {} steps: @@ -67,13 +67,13 @@ - to: start completed: - !type:SpawnPrototype - prototype: GlassSheet1 + prototype: SheetGlass1 amount: 2 - !type:SpawnPrototype - prototype: MetalSheet1 + prototype: SheetSteel1 amount: 2 - !type:SpawnPrototype - prototype: PlasmaSheet1 + prototype: SheetPlasma1 amount: 2 - !type:DeleteEntity {} steps: