Smart Filter Inserter (count-aware stack size)


Inserters whose filters are set from the circuit network use each filter signal's COUNT as a per-item hand stack size, trimmed by what the drop target already holds. Lets a circuit-filtered inserter load an exact amount with no overshoot. Useful on its own, and pairs with Precise Train Logistics for exact train loading.

Content
7 days ago
2.0
15
Logistics Circuit network Storage

Changelog

Version: 0.1.0
Date: 2026-06-11
  Features:
    - An inserter set to "set filters from circuit network" reads each filter signal's COUNT as a per-item hand stack size, so it loads an exact amount instead of always grabbing a full hand.
    - The amount is trimmed by what the drop target already holds, so a chest, wagon or machine is filled to exactly the requested count with no overshoot.
    - Works for any inserter dropping into an item container (chests, wagons, machines); belts are skipped.
    - The inserter is held disabled until a concrete amount is known and its hand size is set, so it never grabs a full stack on the first swing before the override applies.
    - Inserters beside a parked train are processed every tick for its whole stay, so loading starts within a tick of arrival AND the hand stack size stays in lockstep with the remaining amount. Otherwise the round-robin (which on a large base can lag seconds behind) would leave a stale, too-large stack size and overshoot the wagon, or miss the train's stay entirely. Trains already parked when the mod loads are picked up on the first tick.
    - An inserter mid-swing holding an item is never frozen: the request can momentarily read 0 the instant an item leaves the chest but before it reaches the wagon, and freezing then would strand the item in the hand. It now finishes the drop and disables once empty.
    - When several items are filtered at once, the inserter loads at full capacity instead of crawling at the smallest item's count (a single scalar stack size can't be exact for all of them anyway). A single filtered item still loads exactly to its count.
    - "Inserters updated per tick" setting to bound the work done each tick on large bases.
    - /sfi-debug command writes a dump of the hovered inserter (registration, control state, override, circuit signals, per-item remaining) to script-output/sfi-debug.txt.