StarOS: hopper
Part hopper, 1 port. It carries 4 000 kg and 1 600 L; the first limit reached wins. See the overview.
| member | meaning |
|---|---|
hopper.capacity |
4 000 (kg) |
hopper.capacity_volume |
1 600 (L) |
hopper.cargo() |
dict item to quantity, as the turn began |
hopper.free() |
kilograms of room left |
hopper.free(item) |
whole units of that item that still fit |
hopper.unload() |
record the unloading of everything |
hopper.pickup(item, quantity) |
record a pick-up; a second call replaces the first |
hopper.load does not parse: load is a Starlark keyword. Use cargo().
Unload and pickup act at the end of the turn, on the four side cells only, never the diagonals, and only on your own things. Unload goes to depots and buildings that take the item, then to containers of your train stops, wagons and haulers. What does not fit stays in the hopper.
def tick():
if len(hopper.cargo()) > 0:
hopper.unload()
else:
hopper.pickup("iron_ore", 10)