Skip to content

breakpoints

Path: examples/breakpoints.

A tiny control mod for exercising Rust-line breakpoints through factorio-rs dap. Comments in src/lib.rs mark the best gutter lines to stop on.

Prerequisites: Factorio 2.1+, FACTORIO_PATH, and the factorio-rs DAP editor contribution.

Terminal window
cd examples/breakpoints
factorio-rs build --profile debug # writes dist/lua/*.lua.map.json

In VS Code / Zed:

  1. Open examples/breakpoints as the folder or focus src/lib.rs under the monorepo
  2. Set a gutter breakpoint on a line
  3. Start factorio-rs DAP - VS Code uses .vscode/launch.json; Zed uses .zed/debug.json (install editors/zed-factorio-rs-dap as a dev extension first)
  4. Close any other Factorio window, then load/create a game so control runs
Handler Best stop When it runs
on_singleplayer_init debugger_breakpoint!(...) line New singleplayer game
on_tick if game.tick() % 60 == 0 Once per second while playing
on_player_created if let Some(player) = ... Player entity created

debugger_breakpoint! only pauses with FMTK’s legacy __DebugAdapter global. Under native Factorio 2.1 DAP, set a gutter breakpoint on a STOP line.

See also: Debugging, CLI.