How gusxo999/flg works
This is a Factorio factory-layout editor and automatic layout planner. The main workflow is editing a grid, selecting a recipe and machine inputs, running auto-layout, then inspecting or exporting the resulting blueprint. The README describes the planner as recipe-tree expansion followed by module placement, with separate stages for module links, inter-module channels, and perimeter exports. Other documented capabilities include custom recipes, Factorio data handling, belt/fluid analysis, and blueprint import/export. Some planner and UI implementations were not sampled; those links are included only where the README or source index supports them.
Main entry points: layoutStore.ts Layout state · App.tsx Editor shell · body.ts Module planning · emit.ts Layout emission
Components 26
Editor UI
- Editor shell
src/App.tsx - Grid canvas
src/UI/components/GridCanvas.tsx - Toolbar
src/UI/components/Toolbar.tsx - Auto-layout panel
src/UI/components/AutoLayoutModal.tsx - Layout state
src/UI/store/layoutStore.ts - Run state
src/UI/store/autoLayoutRunStore.ts - Canvas renderer
src/UI/pixi/pixi-manager.ts - Layout model
src/types/layout.ts
Game Data
- Game data state
src/UI/store/gameDataStore.ts - Game data parser
src/factorio/parseGameData.ts - Custom recipes
src/factorio/customRecipe.ts
Auto Layout
- Recipe tree
src/autoLayout/tree/build.ts - Module planning
src/autoLayout/module/shape/body.ts - Module model
src/autoLayout/module/types/module.ts - Module links
src/autoLayout/link/build.ts - Channel reservation
src/autoLayout/channel/shape.ts - Perimeter export
src/autoLayout/perimeter/late.ts - Layout emission
src/autoLayout/module/emit.ts - Grid geometry
src/autoLayout/shared/grid.ts
Analysis
- Belt flow
src/analysis/beltFlow.ts - Pipe network
src/analysis/pipeNetwork.ts
Blueprint I/O & Debug
- Blueprint codec
src/blueprint/blueprintCodec.ts - Blueprint items
src/blueprint/blueprintItemsCodec.ts - Debug API
src/debug/debugApi.ts - Blueprint model
src/types/blueprint.ts
Other components
- Factory designer
Connections 27
- Factory designer → Editor shell: uses editor
src/App.tsx - Editor shell → Toolbar: renders
src/App.tsx - Editor shell → Grid canvas: renders
src/App.tsx - Editor shell → Auto-layout panel: renders
src/App.tsx - Grid canvas → Layout state: edits state
- Layout state → Layout model: stores grid
src/UI/store/layoutStore.ts - Canvas renderer → Layout state: subscribes
src/UI/pixi/pixi-manager.ts - Canvas renderer → Game data state: subscribes
src/UI/pixi/pixi-manager.ts - Toolbar → Game data parser: imports data
- Game data parser → Game data state: loads data
- Custom recipes → Game data state: merges recipes
src/factorio/customRecipe.ts - Auto-layout panel → Run state: starts layout
- Run state → Recipe tree: runs planner
- Recipe tree → Module planning: builds modules
- Module planning → Module links: plans links
- Module planning → Module model: creates model
src/autoLayout/module/shape/body.ts - Module links → Channel reservation: reserves channels
- Channel reservation → Perimeter export: reserves exits
- Module planning → Layout emission: emits layout
src/autoLayout/module/emit.ts - Layout emission → Grid geometry: uses geometry
src/autoLayout/module/emit.ts - Layout emission → Layout state: writes grid
- Layout state → Belt flow: analyzes flow
- Layout state → Pipe network: analyzes network
- Layout state → Blueprint codec: exports layout
- Blueprint codec → Blueprint model: encodes
src/blueprint/blueprintCodec.ts - Blueprint items → Blueprint model: encodes items
src/blueprint/blueprintItemsCodec.ts - Factory designer → Debug API: runs diagnostics
src/debug/debugApi.ts