Train Priority is set dynamically by reading the contents of the buffer storage at any given station. The blueprint is parametrized so you can just set the total number of chests in the station
For those interested in the math (pretty basic):
- Calculate total stacks available in station i.e no of chests x 48 (steel chest has 48 slots)
- Get stack size of the item (can be dynamically gotten using selector combinator)
- Get total capacity of station i.e no of chests x 48 x stack size
- Read contents of chest with wires and divide by total capacity (We multiply this by 100 to get the percentage)
- Subtract above value from 100 since this is an unloading station (if no content in buffer chests, then priority = 100-0 = 100)
Notes:
- The multiplication by 100 happens before the division by total capacity to get the percentage accurately otherwise since current/total is always between 0 and 1, the game will consider it as a 0.
- The multiplication constant can be changed from 100 to 255 since 255 is the limit of the train priority value so instead of 0 to 100, the priority will be dynamically adjusted from 0 to 255.
