Many devices have slots: lockers, battery chargers, furnaces, hydroponics. What sits in a slot is not read with l, but with dedicated instructions and dedicated names, the LogicSlotTypes.
ls: read a slot
ls used locker 0 Occupied # 1 if something is in slot 0
ls count locker 1 Quantity # stack size in slot 1
Slot numbers count from 0. Which slots a device has is listed in the Stationpedia.
| LogicSlotType | Meaning |
|---|---|
Occupied | something inside? (0/1) |
Quantity | stack size |
OccupantHash | prefab hash of the item |
Charge, ChargeRatio | charge of a battery in the slot |
Damage | damage |
LogicTypes and LogicSlotTypes are two separate lists. ls … Temperature does not exist, even though the word appears in both – the checker tells you which names are valid where.
lbs: slots across the network
lbs total LOCKER 0 Quantity Sum
Reads slot 0 of all devices of the type and combines them. Here Sum is right: stack sizes really add up. With names there is lbns.
Writing
ss writes into a slot – only a few devices allow it, for example to lock a compartment. Mostly you read.
Diagram
Exercise
Task
A locker is attached to d0, a second identical locker sits on the network (prefab StructureStorageLocker). In an endless loop:
r0= 1 if something is in slot 0 of the locker ond0r1= stack size in slot 1 of the locker ond0r2= sum of the stack sizes in slot 0 of all lockers
Hints
Hint 1
ls used locker 0 Occupied reads slot 0.
Hint 2
The LogicSlotType for the stack size is Quantity.
Hint 3
Across all lockers: lbs total LOCKER 0 Quantity Sum.