- Name: Automatic train deployment
- Version: 0.1.8
- Factorio-Version: 0.15.18, 0.15.33, 0.15.37, 0.16.15, 0.17.0. 0.18.0
- Description: Adds means of automatically deploying and deleting trains
- Multiplayer: untested
- License: http://unlicense.org/
- Release: 2017-06-12
- Download-Url: https://mods.factorio.com/mod/AutomaticTrainDeployment
- Website: viewtopic.php?f=93&t=49689,
- Source: GitHub
- Category: Gameplay
- Tags: Trains
Source trains should no longer be parked at the input stop, it is enough that they are roughly in position to make them recognizable. This means that the source schedule should no longer contain the input stop. There is migration code included with 0.1.1 that should upgrade any setup working in 0.1.0 to the new system. However if anything is broken this is probably what has caused it.
As parts of the details are no longer relevant I'll
Details and usage
As this mod was made mainly for testing purposes it does not really fit into the game, while there is tech and recipes for the different buildings the trains are pulled from/to thin air. A big reason for this is that there are actually, AFAIK, pretty few places mods can hook code into that would facilitate this, and it really was outside the scope of what I needed. If anyone wants to use this as a base for a better mod, feel free, it's unlicensed.
Anyway, on to the explaining:
Added:
Technology: Automated train deployment - research to unlock this stuff
Recipes/items/entities: Train deletion stop, Automatic deployment input stop, Copying train output, Randomizing train output - different kinds of trains stops that interact to make this stuff possible.
The main components:
Train deletion stop - Deletes any train that stops there, wagons, cargo, fuel, and all. Pretty straight forward.
Automatic deployment input stop - Used in conjunction with the output stops. Any trainstopped(trains just need to be in roughly the correct spot) here can be used as a source for an output stop.
Copying train output - Creates a copy of the train at the chosen input stop. Copies wagons and fuel (no cargo) and the schedule of the source trainexcluding the entry for the input stop. It also sets the destination to the first entry in the schedule.
Randomizing train output - Works just like the above stop with the exception that is selects a random destination from the schedule in stead of just choosing the first one. The probability of each destination can be controlled by giving it a different weight. This is done by making the first wait condition one which allows using a constant (item count and circuit conditions) and setting the constant to the desired weight (default value is 100 if no such wait condition exists)
Connecting input and output stops:
When an output stop is triggered it searches its circuit networks for an enabled input stop and takes the first one with aparked train it finds. Note that it is possible to connect multiple input stops to the same output and using enable/disable on the input stops to select which one to use. It is also possible to connect the same input stop to multiple output stops with no problems.
Triggering output stops:
An output stop will try to do its thing once each time a train tries to path to it.
Settings on output stops:
Whether the created train should be in automatic mode is controlled by sending circuit signal A > 0 to the output station.
The starting speed of the train can also be controlled somewhat with the circuit signal S > 0 in the same way. (Fixed in 0.16: Unfortunately this setting is not as useful as I'd hoped, the ceiling is pretty low, the train stops quickly, and if auto is on the train needs to stop before it starts driving by itself).
Basic example:
This is one of the most basic setups possible to make the system work. Important things to notice: north train has no fuel, south train is waiting at the input stop (make sure to give it a wait condition that is never true).
Every time the north train is set to automatic a copy of the south train is spawned that tries to go to the goal stop (make sure that the train at the input stop has fuel).
Basic automatic example:
Base setup is the same as above with the addition of three rail signals and a piece of wire. This time the north train is an on/off switch. If it is set to automatic trains will be spawned one after the other as soon as they clear the output stop. Important to notice is the gap between the stop and the rail signal after it, with out the gap the newly spawned train will automatically connect with the old one.
Anyway, on to the explaining:
Added:
Technology: Automated train deployment - research to unlock this stuff
Recipes/items/entities: Train deletion stop, Automatic deployment input stop, Copying train output, Randomizing train output - different kinds of trains stops that interact to make this stuff possible.
The main components:
Train deletion stop - Deletes any train that stops there, wagons, cargo, fuel, and all. Pretty straight forward.
Automatic deployment input stop - Used in conjunction with the output stops. Any train
Copying train output - Creates a copy of the train at the chosen input stop. Copies wagons and fuel (no cargo) and the schedule of the source train
Randomizing train output - Works just like the above stop with the exception that is selects a random destination from the schedule in stead of just choosing the first one. The probability of each destination can be controlled by giving it a different weight. This is done by making the first wait condition one which allows using a constant (item count and circuit conditions) and setting the constant to the desired weight (default value is 100 if no such wait condition exists)
Connecting input and output stops:
When an output stop is triggered it searches its circuit networks for an enabled input stop and takes the first one with a
Triggering output stops:
An output stop will try to do its thing once each time a train tries to path to it.
Settings on output stops:
Whether the created train should be in automatic mode is controlled by sending circuit signal A > 0 to the output station.
The starting speed of the train can also be controlled somewhat with the circuit signal S > 0 in the same way. (Fixed in 0.16: Unfortunately this setting is not as useful as I'd hoped, the ceiling is pretty low, the train stops quickly, and if auto is on the train needs to stop before it starts driving by itself).
Basic example:
- basic ex.png (223.41 KiB) Viewed 21671 times
Every time the north train is set to automatic a copy of the south train is spawned that tries to go to the goal stop (make sure that the train at the input stop has fuel).
Code: Select all
0eNqtmM1u4jAUhd/F61DFPwmBxUiV5hG6G1UoJG5rKXEix0GDUN59bNwBShNxLHUDMrG/2Pf6+PpwIvtmlL1R2pLtiaiq0wPZ/jmRQb3rsvG/2WMvyZYoK1uSEF22vmVK1ZApIUrX8i/Z0uk1IVJbZZUM48+N406P7V4a1+EycrBu7PuHXZ0RCem7wY3qtH+VI62YSMjRfeeOXisjq/CQTck3KMOhDIbyC7QazUHWS0i6DsjsK5LPIAWKpAFJvyLXM8gMXjoP8UwfrzzHmQxlrnFmijILPO0FytzgzBxl0jR20yNQGrvpEWiEkuA0UQ5DKZwnKnAonihcTRRPFC4niicK1xPFE4ULCs8TLig4TQzXE5wlFiEnmAmrCU4Rg7WEzxJWEh5MWEd4zmEVwVuTwRrCJcRgCeFaZ7CE8EOJwxLCT08OSwg/5jksIbwecVxDcI44LCK8wnNYRfhVhMMywq9MHNYRfrXjsI7wKyi/6uh5tF1bWlW9OKj+LfumO7au+6rq+uNqsF2/WJ/Y3YsS4qySNV2z28uP8qA64/tXylSjsjv3rL5A3pQZ7O6boTooY8eyuXqq0GP1bqTU3lt5L2ZLb8xS32j70pTWv4f88o99fPTOT7qXNY5/IVNg67CWwY+h/sPI+ta6KdcSqTd2YUZ3j7J8ep2mObdzPWP+r8DFt90rfZ79zM3/KQshfrrzUmI+yG+qsdIs2NSlZT+HiI4+nPTWt+LB4JulFdPHO6yWjbRyYY99bmb2eDMLFmv8AMsreKzzQ6Ai1voh0CzW+yHQPNb8IdB1rPlDoEWs+UOgm1jzB0CzNNb8IVAaa/4QKIs1fwiUx5o/BCpizR8CzSLNH8LMH5+HRpb1UsUNLyqgivvjVXC22H0e/a4Wnv8G3d78a5qQgytG5ynmQrAsLzZpUUzTPxauF7c=
- auto ex.png (208.63 KiB) Viewed 21671 times
- auto train test.zip
- Example with setup pretty close to the image above
- (2.38 MiB) Downloaded 335 times
Code: Select all
0eNqtmMFuozAYhN/FZ1KBDQnJoVKlfYTeVitE4G9rCQwyJtoo4t3XBppNWlDGUi+JHOAj/sdje3xhx6qnVktl2OHCZNGojh1+X1gn31Veud/MuSV2YNJQzQKm8tq1dC4rNgRMqpL+skM0/AkYKSONpOn5sXHOVF8fSdsbrk92xj77/mE2IyJgbdPZpxrlXmVJGx4H7Gy/t5ZeSk3FdJEPwTcox6EchoortOj1ico1ZLSbkMk9UiwgYxQZTcjoHrlbQCZ3SmxmtRaQ8VMyQ5+Sx9gtXFExyRQ+LugOZ3KUmeLMEGXu8dGUoswoxKFbGOptJgTqbSYEKnAorFMUw9AIFyrBobhQuJ0iXCjcTxEuFG6oCBcKdxSsE8cNBcvEcT/BKnEPO8FM2E2wRBz2Ev4vYSfhxYR9hGsOuwgfmrCHcAtx2EK41wVsIXxSErCF8NlTwBbCp3kBWwhfjwTuIVwj2ET4Ci9gF+FbEQHbCN8zCdhH+N5OwD7C96BxiO7B+bwH/7YFt3W2gcvopsqO9JGfZKPdQ4XURS9NVlRNR9lnEnvLq46C60VNeXm9ZnRPwwhTE7tznMh9aCpvA5m0rdjGtWFY6tJ/G7/0pqlzI4tX2zn1i9qqOdf29k3RtOdNZ5p2dcnlX2r3oJONKq+QN6k7k33LniepTT/W9lPE8Y7NuyZSbOp4Z3KXYUPXqNtc58a9hz2Pl+d3kcqPFWWl7Nz3VLaAdaTKzDSZGxjqWuexlbmOtlTif+mVDR5ChDcijD8IF6Snbn25N9mvicbBcShWh+ES9SYHz8W10tdHqcbCrtP5V3q8rP+brAzplcOGteq+TGL3Tuno9vThJwZ//Hjwl1SRoZXhP08dHJg6Et+cDRxcxFvfoI1Ad75JG4GmvlEbge59ozYATULfqI1AI9+ojUC5b9RGoMI3aiPQ2DdqI9DEN2oj0K1v1EagO9+ojUBTz6iNMPeP50O3CVnbDEwvSqHNwI8vtotL6Dz12xV2PMw+3Jx9B+xkF6NpNYxjnmzTfZimw/APRSOxsg==
Mod settings
Auto/manual for created trains: Which state should trains be created in? Or use circuit signal A on the output stop to decide.
Use S to control starting speed: Whether or not to use circuit signal S to set starting speed of created trains.
Delete on approach: Deletes the train on ARRIVE_STATION instead of WAIT_STATION.
Use S to control starting speed: Whether or not to use circuit signal S to set starting speed of created trains.
Delete on approach: Deletes the train on ARRIVE_STATION instead of WAIT_STATION.
Changelog
Feedback/bug reports/questions welcome!0.1.0 Initial release
0.1.1 Removes the need for the source train to be waiting at the input station, see thread for details.
0.1.2 Adds support for copying locomotive colour, cargo/fluid wagon contents, wagon filters/tank settings.
0.1.3 Added checks for the initial parameters being garbage, should fix a potential crash.
0.1.4 Updated to 0.16.
0.1.5 Added some mod settings to make things simpler/more efficient.
0.1.6 Updated to 0.17, fixed logic issue with speed and auto, made default settings fit throughput tester.
0.1.7 Updated to 0.18.
0.1.1 Removes the need for the source train to be waiting at the input station, see thread for details.
0.1.2 Adds support for copying locomotive colour, cargo/fluid wagon contents, wagon filters/tank settings.
0.1.3 Added checks for the initial parameters being garbage, should fix a potential crash.
0.1.4 Updated to 0.16.
0.1.5 Added some mod settings to make things simpler/more efficient.
0.1.6 Updated to 0.17, fixed logic issue with speed and auto, made default settings fit throughput tester.
0.1.7 Updated to 0.18.
Enjoy!