Chest & Fluid Slot Reader plus train priority signals

by Wextor

Read empty, full, total slots from chests and fluid tanks and send signal to network. E = empty (slots for chests, fluid units for tanks), F = full/used (slots or fluid amount), T = total capacity (slots or fluid capacity), Also gives signal for priority for the trains based of filled capacity of container. P = priority full 0..255 (255 when full, 0 when empty), R = priority empty 0..255 (255 when empty, 0 when full), Links to the nearest valid target on placement. Easy way to create generic train station and set train permission based of usage of the chests.

Utilities
a day ago
2.0
7
Trains Circuit network
Owner:
Wextor
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
a day ago
Latest Version:
1.0.1 (a day ago)
Factorio version:
2.0
Downloaded by:
7 users

Chest & Fluid Reader (E/F/T + P/R)

Make train station limits and circuit logic respond to real storage fill levels.
This reader automatically links to the nearest chest, storage tank, or (cargo/fluid) wagon and outputs five virtual-letter signals on the circuit network:

E - Empty: free slots (chests) or free fluid capacity (tanks/wagons)

F - Full/Used: used slots (chests) or fluid amount (tanks/wagons)

T - Total capacity: slots or fluid capacity

P - Priority-Full (0..255): 0 when empty → 255 when full

R - Priority-Empty (0..255): 255 when empty → 0 when full

That’s it - no GUI, no setup, just plug into your circuit network.

Why you might want this

Smarter train dispatching - drive Train directly from how full/empty a stop is.

Pickup stations: feed P (fullness) to signal L → trains prefer fuller stops.

Drop-off stations: feed R (emptiness) to L → trains prefer emptier stops.

Simple scaling - you get 0..255 priorities out of the box; no combinator gymnastics needed.

Universal - works with vanilla and modded chests, tanks, cargo wagons, fluid wagons (any size).

Quick start

Place the reader next to the target (chest/tank/wagon).
It auto-links to the closest bounding box (so a 1×1 chest right next to it wins over a 5×5 tank slightly farther away).

Wire the reader to your circuit network (red/green wire).

Use the signals: E, F, T, P, R now appear on the network.

Train Limit setup (two common patterns):

Pickup bias (full first): in the station UI enable Set priority from circuit, if you have more than 1 chest use arithmetic device to divide priority signal by the amount of chests.

Drop-off bias (empty first): Same as above but for empty slots.

Auto-linking behavior

Layered scanning (1.2 → 2.2 → 3.2 → 4.2 → 6.2 → 9.0 tiles) - stops as soon as it finds a candidate in a layer.

Closest by bounding-box distance, not by center point - reliably picks nearby 1×1 targets even when a big 5×5 tank is close.

Persistent link - the reader remembers its target; it relinks only when the target disappears or when you rotate the reader.

Unlock & recipe

Technology: unlocks with Circuit network (same tier as the constant combinator).

Recipe: 5× Copper cable, 5× Electronic circuit.

Performance & multiplayer

Updates every 30 ticks (~2×/s) by default; lightweight and UPS-friendly.

Works in multiplayer. No GUI, no per-player state.

Blueprint-friendly: the link is re-established automatically on placement/rotation.

Compatibility

Factorio 2.0+.

Vanilla & modded chests, logistic/linked containers, cargo wagons, storage tanks, fluid wagons.

Uses circuit network only; it does not touch the logistics network.