Train Depot


Automatically clones trains at new advanced train stations called train depots. The train to clone is set by a circuit network signal sent to the station. It can clone schedule and filter settings as well as the carriages. Also adds a combinator that sends a signal counting the number of trains scheduled for a station it is placed next to. Check the mod portal for details on signals and usage.

Content
5 years ago
0.16
5
Trains

i Train Counter combinator

5 years ago

Can the train counter combinator send a second signal for the number of trains with the current station as their active target ?

Eg
C = total trains with station A somewhere in their schedule
A = number of trains with station A as their current target.

5 years ago

Looking at the API I think it would also be possible to count the number of trains STOPPED at the target location as a THIRD signal value.

The idea that I am looking at is to manage the number of trains being sent to a stacker with some smarts.

5 years ago

@billbo: there is a mod "Train Supply Manager" which manages the number of trains being sent from a stacker to a station with some smarts. it also supplies a signal for the number of trains that are currently en route to or stopped at some station.

5 years ago

This may be a little over engineered. But I wanted to have a local and external supply depot. The local supply depot would be close to the request station and have 2-3 trains waiting there. The External supply depot would have room for 50+ trains. The trains would be sent from the Ore outpost to the external depot and held there until a slot was released at the local depot.

I am thinking the remote supply depot would have train signal that would only go green once the train counter said there were less than X trains stopped at the local supply depot.

Maybe I can make these changes myself and see how my idea pans out.

5 years ago

@billbo99 I did think about that when I added the combinator, but it's a lot more complicated, so I didn't add it. Now that I know someone would be interested in using a signal like that, I'll look into it further.

5 years ago
(updated 5 years ago)

Not saying this is sexy code .. but this is what I did to brute force it to work ...

https://pastebin.com/bEAWSnXE

5 years ago

PS .. I had to rename the combinator to .. "train-stop-counter" .. as the Mod (Train Supply Manager) I wanted to use this with already had an entity called "train-counter"

5 years ago

The name collision is entirely my bad. I should have prefixed it to the mod name, as in train-depot-stop-counter (or something).
https://github.com/taerin-markman/TrainDepot/issues/26

I created these two for each of the new signals:
https://github.com/taerin-markman/TrainDepot/issues/27
https://github.com/taerin-markman/TrainDepot/issues/28

Thanks for the sample code! I need to think about it some more to be sure it won't be a perf issue on mega bases, so it'll be a bit more time before I can update the mod. In the mean time, you can submit that as a pull request directly, or I can add it and give you credit. I'll plan on doing the latter unless I hear otherwise.

New response