-
Notifications
You must be signed in to change notification settings - Fork 0
How Community Factories Load
The main challenge with community factories is the chunk loading mechanism. This is a logical walkthrough of that process.
Attached to the Factory Inspection station block is a 3x3 chunk loader (boot loader). Located within this 3x3 region is the power sources for the factory and a second chunk loader (sustain loader). The purpose of this first stop is to boot up the power plant and provide power to the sustain loader which can operate when a train isn't at a station. 15 seconds is provided for that process to stabilize (steam plants can take a few seconds to fuel up).
When the train leaves the Factory Inspection station, the boot loader unloads and the factory needs to remain loaded by the sustain loader. To ensure this, the sustain loader has a clutch which is deactivated by a redstone signal. When a train is at any factory station, including the Factory Inspection station it outputs a signal with a 30s pulse extender. This keeps the sustain loader operating while trains move between loading stations. Additionally, threshold switches on each of the storage buffers can keep the factory loaded, allowing it to operate and refill inventories after trains leave.
What happens in the factory for a train with the following schedule:
- Travel to Factory Inspection, continue after 15 seconds
- Travel to Factory Product 1 Load, continue after 54 stacks of Product 1 or after 15 minutes
- Travel to Factory Product 2 Load, continue after 27 stacks of Product 2 or after 15 minutes
- Travel to Base, continue when empty
(1) Train arrives at Factory Inspection, boot loader activates, power plant and sustain loader load, redstone signal with a 30s extender from the Factory Inspection station block activates the sustain loader. From here out, the sustain loader needs to have a continuous redstone signal generated to keep the factory loaded. (2) Train leaves Factory Inspection disabling the boot loader and moves forward to Factory Product 1 Load station, which continues the redstone signal with 30s extender. Train stays until the 54 stacks of that product are loaded or until the 15 minute timeout is reached and then (3) continues to Factory Product 2 Load station. Here again, the redstone signal is refreshed with 30s extender, train waits for 27 stacks or 15 minutes, and then leaves (4). Redstone signal continues for 30s.
If the factory needs to remain loaded to restock, the threshold switches can keep it loaded while it does that. If the factory has restocking trains, those shouldn't need to utilize the boot loading station as the factory should either still be loaded due to the threshold switches or the train can simply arrive at the unloaded factory and sit there until some train arrives to load the factory to power it up and allow it to start emptying.
The 15 minute timeout for each station needs to be added in the event that something in the factory breaks or that any input items to the factory become unavailable and the loading condition cannot be met. This would create a situation where the train gets stuck at the factory, and if additional trains arrive, block access to the factory for trains that are bringing ingredients needed to satisfy the request, so trains need a timeout and users need to be prepared for trains to return without orders being satisfied. This could lead to a race condition where trains are repeatedly visiting a factory, timing out, returning to base and immediately leaving again. A longer timeout for the base station schedule may be needed.