|
@@ -1,68 +1,70 @@
|
|
|
import type { Recipe } from "../../scripts/factorio-dump/helpers/recipes.helper";
|
|
import type { Recipe } from "../../scripts/factorio-dump/helpers/recipes.helper";
|
|
|
import type { Machine } from "../../scripts/factorio-dump/process-data.models";
|
|
import type { Machine } from "../../scripts/factorio-dump/process-data.models";
|
|
|
import type { MachineSetup } from "../engine";
|
|
import type { MachineSetup } from "../engine";
|
|
|
-import FactorioSimulationDashboard from "../engine/FactorioSimulationDashBoard";
|
|
|
|
|
|
|
+import FactorioSimulationDashboard from "../engine/Dashboard/FactorioSimulationDashBoard";
|
|
|
import { Chest, FactorioEngineOrchestrator, InserterSimulator, MachineSimulator } from "../engine/simulator";
|
|
import { Chest, FactorioEngineOrchestrator, InserterSimulator, MachineSimulator } from "../engine/simulator";
|
|
|
|
|
|
|
|
const orchestrator = new FactorioEngineOrchestrator();
|
|
const orchestrator = new FactorioEngineOrchestrator();
|
|
|
|
|
|
|
|
- const copperCableRecipe: Recipe = {
|
|
|
|
|
- name: "copper-cable",
|
|
|
|
|
- energy_required: 0.5,
|
|
|
|
|
- ingredients: [{ type: "item", name: "copper-plate", amount: 1 }],
|
|
|
|
|
- results: [{ type: "item", name: "copper-cable", amount: 2 }],
|
|
|
|
|
- } as Recipe;
|
|
|
|
|
|
|
+const copperCableRecipe: Recipe = {
|
|
|
|
|
+ name: "copper-cable",
|
|
|
|
|
+ icon: "item/copper-cable.png",
|
|
|
|
|
+ energy_required: 0.5,
|
|
|
|
|
+ ingredients: [{ type: "item", name: "copper-plate", amount: 1 }],
|
|
|
|
|
+ results: [{ type: "item", name: "copper-cable", amount: 2 }],
|
|
|
|
|
+} as Recipe;
|
|
|
|
|
|
|
|
- const greenCircuitRecipe: Recipe = {
|
|
|
|
|
- name: "electronic-circuit",
|
|
|
|
|
- energy_required: 0.5,
|
|
|
|
|
- ingredients: [
|
|
|
|
|
- { type: "item", name: "iron-plate", amount: 1 },
|
|
|
|
|
- { type: "item", name: "copper-cable", amount: 3 },
|
|
|
|
|
- ],
|
|
|
|
|
- results: [{ type: "item", name: "electronic-circuit", amount: 1 }],
|
|
|
|
|
- } as Recipe;
|
|
|
|
|
|
|
+const greenCircuitRecipe: Recipe = {
|
|
|
|
|
+ name: "electronic-circuit",
|
|
|
|
|
+ icon: "item/electronic-circuit.png",
|
|
|
|
|
+ energy_required: 0.5,
|
|
|
|
|
+ ingredients: [
|
|
|
|
|
+ { type: "item", name: "iron-plate", amount: 1 },
|
|
|
|
|
+ { type: "item", name: "copper-cable", amount: 3 },
|
|
|
|
|
+ ],
|
|
|
|
|
+ results: [{ type: "item", name: "electronic-circuit", amount: 1 }],
|
|
|
|
|
+} as Recipe;
|
|
|
|
|
|
|
|
- const assemblerSetup: MachineSetup = {
|
|
|
|
|
- machine: { name: "assembling-machine-2", crafting_speed: 1 } as Machine,
|
|
|
|
|
- machineModules: [],
|
|
|
|
|
- beacons: [],
|
|
|
|
|
- machineQualityLevel: 0,
|
|
|
|
|
- };
|
|
|
|
|
|
|
+const assemblerSetup: MachineSetup = {
|
|
|
|
|
+ machine: { name: "assembling-machine-2", icon: "item/assembling-machine-2.png", crafting_speed: 1 } as Machine,
|
|
|
|
|
+ machineModules: [],
|
|
|
|
|
+ beacons: [],
|
|
|
|
|
+ machineQualityLevel: 0,
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
- const cop1 = new MachineSimulator(assemblerSetup, copperCableRecipe, { "copper-cable": 200 });
|
|
|
|
|
- const cop2 = new MachineSimulator(assemblerSetup, copperCableRecipe, { "copper-cable": 200 });
|
|
|
|
|
- const cop3 = new MachineSimulator(assemblerSetup, copperCableRecipe, { "copper-cable": 200 });
|
|
|
|
|
|
|
+const cop1 = new MachineSimulator(assemblerSetup, copperCableRecipe, { "copper-cable": 200 });
|
|
|
|
|
+const cop2 = new MachineSimulator(assemblerSetup, copperCableRecipe, { "copper-cable": 200 });
|
|
|
|
|
+const cop3 = new MachineSimulator(assemblerSetup, copperCableRecipe, { "copper-cable": 200 });
|
|
|
|
|
|
|
|
- const circ1 = new MachineSimulator(assemblerSetup, greenCircuitRecipe, { "electronic-circuit": 200 });
|
|
|
|
|
- const circ2 = new MachineSimulator(assemblerSetup, greenCircuitRecipe, { "electronic-circuit": 200 });
|
|
|
|
|
|
|
+const circ1 = new MachineSimulator(assemblerSetup, greenCircuitRecipe, { "electronic-circuit": 200 });
|
|
|
|
|
+const circ2 = new MachineSimulator(assemblerSetup, greenCircuitRecipe, { "electronic-circuit": 200 });
|
|
|
|
|
|
|
|
- const sourceCopper = new Chest("copper-plate");
|
|
|
|
|
- const sourceIron = new Chest("iron-plate");
|
|
|
|
|
- const sinkGreenChips = new Chest();
|
|
|
|
|
|
|
+const sourceCopper = new Chest("copper-plate");
|
|
|
|
|
+const sourceIron = new Chest("iron-plate");
|
|
|
|
|
+const sinkGreenChips = new Chest();
|
|
|
|
|
|
|
|
- // ALL inserters set to Stack Size 16
|
|
|
|
|
- const inCop1 = new InserterSimulator(16, sourceCopper, cop1, "copper-plate");
|
|
|
|
|
- const inCop2 = new InserterSimulator(16, sourceCopper, cop2, "copper-plate");
|
|
|
|
|
- const inCop3 = new InserterSimulator(16, sourceCopper, cop3, "copper-plate");
|
|
|
|
|
|
|
+// ALL inserters set to Stack Size 16
|
|
|
|
|
+const inCop1 = new InserterSimulator(16, sourceCopper, cop1, "copper-plate");
|
|
|
|
|
+const inCop2 = new InserterSimulator(16, sourceCopper, cop2, "copper-plate");
|
|
|
|
|
+const inCop3 = new InserterSimulator(16, sourceCopper, cop3, "copper-plate");
|
|
|
|
|
|
|
|
- const inIron1 = new InserterSimulator(16, sourceIron, circ1, "iron-plate");
|
|
|
|
|
- const inIron2 = new InserterSimulator(16, sourceIron, circ2, "iron-plate");
|
|
|
|
|
|
|
+const inIron1 = new InserterSimulator(16, sourceIron, circ1, "iron-plate");
|
|
|
|
|
+const inIron2 = new InserterSimulator(16, sourceIron, circ2, "iron-plate");
|
|
|
|
|
|
|
|
- // Direct insertions (Stack size 16)
|
|
|
|
|
- const mid1 = new InserterSimulator(16, cop1, circ1, "copper-cable");
|
|
|
|
|
- const mid2a = new InserterSimulator(16, cop2, circ1, "copper-cable");
|
|
|
|
|
- const mid2b = new InserterSimulator(16, cop2, circ2, "copper-cable");
|
|
|
|
|
- const mid3 = new InserterSimulator(16, cop3, circ2, "copper-cable");
|
|
|
|
|
|
|
+// Direct insertions (Stack size 16)
|
|
|
|
|
+const mid1 = new InserterSimulator(16, cop1, circ1, "copper-cable");
|
|
|
|
|
+const mid2a = new InserterSimulator(16, cop2, circ1, "copper-cable");
|
|
|
|
|
+const mid2b = new InserterSimulator(16, cop2, circ2, "copper-cable");
|
|
|
|
|
+const mid3 = new InserterSimulator(16, cop3, circ2, "copper-cable");
|
|
|
|
|
|
|
|
- const outCirc1 = new InserterSimulator(16, circ1, sinkGreenChips, "electronic-circuit");
|
|
|
|
|
- const outCirc2 = new InserterSimulator(16, circ2, sinkGreenChips, "electronic-circuit");
|
|
|
|
|
|
|
+const outCirc1 = new InserterSimulator(16, circ1, sinkGreenChips, "electronic-circuit");
|
|
|
|
|
+const outCirc2 = new InserterSimulator(16, circ2, sinkGreenChips, "electronic-circuit");
|
|
|
|
|
|
|
|
- const allInserters = [inCop1, inCop2, inCop3, inIron1, inIron2, mid1, mid2a, mid2b, mid3, outCirc1, outCirc2];
|
|
|
|
|
|
|
+const allInserters = [inCop1, inCop2, inCop3, inIron1, inIron2, mid1, mid2a, mid2b, mid3, outCirc1, outCirc2];
|
|
|
|
|
|
|
|
- allInserters.forEach((ins) => orchestrator.registerInserter(ins));
|
|
|
|
|
- [cop1, cop2, cop3, circ1, circ2].forEach((m) => orchestrator.registerMachine(m));
|
|
|
|
|
|
|
+allInserters.forEach((ins) => orchestrator.registerInserter(ins));
|
|
|
|
|
+[cop1, cop2, cop3, circ1, circ2].forEach((m) => orchestrator.registerMachine(m));
|
|
|
|
|
|
|
|
-export function Simulator(){
|
|
|
|
|
- return <FactorioSimulationDashboard orchestrator={orchestrator}></FactorioSimulationDashboard>
|
|
|
|
|
-}
|
|
|
|
|
|
|
+export function Simulator() {
|
|
|
|
|
+ return <FactorioSimulationDashboard orchestrator={orchestrator}></FactorioSimulationDashboard>;
|
|
|
|
|
+}
|