Add Visualize to LayoutResult

This commit is contained in:
hal8174 2025-02-04 23:27:37 +01:00
parent ec869d4c18
commit c472a28591
5 changed files with 73 additions and 35 deletions

View file

@ -1,11 +1,11 @@
use factorio_blueprint::abstraction::{Blueprint, Entity};
use factorio_core::{beltoptions::Beltspeed, prelude::*};
use factorio_core::{beltoptions::Beltspeed, prelude::*, visualize::Visualize};
use factorio_layout::{Connection, Interface, LayoutInput, Layouter, MacroBlock};
use factorio_pathfinding::Pathfinder;
use rand::Rng;
use serde::{Deserialize, Serialize};
use crate::assembly::{assembly_line, assembly_line_2_input};
use crate::assembly::assembly_line_2_input;
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct FactoryGraph {
@ -167,6 +167,8 @@ pub fn generate_factory<L: Layouter, P: Pathfinder>(
};
let l = layouter.layout(&layout_input, pathfinder, rng).unwrap();
l.print_visualization();
let mut b = Blueprint::new();
for (block, mut assembly_blueprint) in l.positions.iter().zip(blueprints) {
let offset = match block.dir() {