Precise Train Logistics


A from-scratch automated train logistics system, and a lean alternative to LTN/Cybersyn. Declare the stock level each station should keep, and the mod runs your trains to maintain it: it reads every station's surplus and shortfall, dispatches idle depot trains from where goods are to where they're needed, loads exact amounts, and parks them again when done. Includes station roles (provider/requester, depot, refuel, sink), automatic train-to-station layout matching, refueling, multi-item deliveries, need-based priority when supply is scarce, and self-healing overstock. Pairs with Smart Filter Inserter for exact item loading.

Content
5 days ago
2.0
43
Logistics Trains
Owner:
ed_mercer
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
10 days ago
Latest Version:
0.1.3 (5 days ago)
Factorio version:
2.0
Downloaded by:
43 users

Precise Train Logistics

Automated train logistics, built from scratch — a lean alternative to LTN and Cybersyn. You tell each station the stock level it should keep, and the mod runs your trains to maintain it.

No hand-written schedules, no babysitting individual trains. Declare "this outpost always wants 50 laser turrets and 20 repair packs" or "keep 10k iron at the base", and the network reads every station's surplus and shortfall, dispatches idle trains to move goods from where they are to where they're needed, loads the exact amount, and parks them again when done.

Highlights

  • Declarative stock targets — set the level to keep; the network tops up toward it and drains anything above it. Self-healing overstock.
  • Fully automatic dispatch — idle depot trains are routed provider → requester → depot with no schedules to write.
  • Exact loading — a provider advertises the precise amount left to load. Items load exactly (via Smart Filter Inserter); fluid pumps are cut off automatically at the target.
  • Layout matching — only trains whose wagons fit a station's loaders are sent (cargo wagons at item loaders, fluid wagons at pumps, exact length, either orientation). No more wrong-sized trains showing up.
  • Need-based priority — when supply is short, the most-depleted station is served first.
  • Multi-item deliveries — one train, several items from the same provider in a single trip.
  • Refueling — low-fuel trains divert to a refuel stop before heading home.
  • Auto-onboarding — set a new train to automatic and it joins the depot pool on its own.
  • Blueprint-friendly — every station setting rides blueprints, ghosts and copy-paste.

How it works

Each station carries a Logistics Reader Combinator. You wire the station's chests/tanks into it and pick a mode:

  • Inventory — the station's actual current stock.
  • Target — the level to keep here (a positive amount).

The mod computes balance = inventory − target per item: above target → the station offers the surplus; below target → it requests the shortfall. A central dispatcher matches surpluses to shortfalls and runs trains to close the gap.

Quick start

  1. Build a train stop with loaders — inserters for items, pumps for fluids.
  2. Place a Logistics Reader Combinator next to it and wire your chests/tanks into its INPUT side.
  3. At a source (e.g. a mine): one reader in Inventory mode, no target → it offers everything it has.
  4. At a destination: one Inventory reader (actual stock) plus one Target reader fed by a constant combinator declaring e.g. iron-plate = 10000.
  5. Mark special stops with a Station Configurator:
  6. Depot — where idle trains wait (build a few).
  7. Refuel — low-fuel trains stop here (give it fuel inserters).
  8. Sink — absorbs overstock nobody asked for.
  9. Send each train to a depot once — or just set it to automatic with an empty schedule and it'll find a depot itself. That's it; the mod takes over.

Station types

  • Normal — provides and/or requests cargo (the default).
  • Depot — idle trains park here between jobs.
  • Refuel — low-fuel trains divert here.
  • Sink — receives leftover overstock; unload into active-provider chests and let bots sort it out.

Commands

  • /ptl-dump — list every station's give/want.
  • /ptl-matches — what the matcher would move right now.
  • /ptl-deliveries — active train deliveries.
  • /ptl-debug — full diagnostic dump to script-output/ptl-debug.txt.
  • /ptl-refresh-schedules — re-apply current rules to in-flight trains.

Settings

Poll interval, refuel threshold, layout enforcement, fluid request deadband (global and per-station), stuck-train warning timeout, and a master dispatch on/off toggle.

Recommended companion

  • Smart Filter Inserter — makes inserters load the exact amount the manifest asks for. Required for exact item loading; fluids work without it.

Notes

  • Station stop names must be unique. Trains route by stop name, so two stops sharing a name will misroute — the mod warns you when it spots duplicates.
  • Designed for a single surface and one connected rail network (a base plus outposts). No network/channel partitioning — it isn't needed at that scale.

Feedback and bug reports welcome. Built as a cleaner, more predictable take on automated train logistics.