Train Network for Players

by leeh

QoL and advanced functionality for players using trains for transport, including improved destination selection dialog and automated train calling.

Content
2 years ago
0.17 - 1.1
7.44K
Transportation

i Add Option to Make Trains Wait at Stops for Curcuit Condition

4 years ago
(updated 4 years ago)

So, I'm trying to design a 'safe train station' using this mod, but I'm running into a problem. As soon as the player exits the train, the train leaves unless I stick it in manual mode first. The problem is that I don't want the train to move until the player has exited the boarding area, but I don't want to stick it in manual mode either, because once the player leaves I want to toggle some gates and release the train so that it can continue on with its normal business. If you could add an option just like LTN to add circuit conditions to the temporary train stops so that you can choose to hold trains at the station until a circuit condition was met, I could use this to build the desired behavior.

Thanks,
Zistack

4 years ago

No worries, seems fair enough and relatively clean to add in..

There's some other stuff I want to do before publishing another release though which is likely to take a while, so in the meantime theres a "unpublished" release for you here to drop into your mods folder (and next will be at least 0.11.4 to avoid any update issues):
https://github.com/leehuk/factorio-tnfp-betarelease/raw/master/TrainNetworkForPlayers_0.11.3.zip

Toggling is done via the /tnp-toggle-redispatch-circuit command in the console and is stored as a player-specific preference. The circuit condition matches ltns description of what it uses, so green=1 OR red=0. It should only apply to redispatch (i.e. you've picked a destination when on board a train), if you summon a train it'll use arrival/boarding timeouts like normal.

Let me know how you get on and whether that works for you.

Cheers, Lee H

4 years ago

Thanks a bunch for implementing this so quickly. That said...

Toggling is done via the /tnp-toggle-redispatch-circuit command in the console and is stored as a player-specific preference.

Does this mean that the circuit conditions are only added for trains that are ridden by players with this preference?

It should only apply to redispatch (i.e. you've picked a destination when on board a train), if you summon a train it'll use arrival/boarding timeouts like normal.

I cannot design a station where I can't expect the trains to behave consistently, since now I have to change the behavior of the gates on the track in front of the train sitting in the station based on whether or not the train will wait (which, as far as I know, I can't check via the circuit network). This setting needs to be a map setting, like it is in LTN, and the circuit condition needs to be added to every temporary stop unconditionally when the setting is set (also like LTN).

Besides the issue of making a station adapt to varied train behavior, it's also impossible to actually guarantee safety unless the condition is unconditionally added. It doesn't really matter how or why a train goes to a station of where it wants to go next. It should not move unless we can guarantee that no player is in the boarding area.

Sorry for not making that clear in the initial feature request,
Zistack

4 years ago
(updated 4 years ago)

Ok, finally found a little time to take a look, this should hopefully be a little closer: https://github.com/leehuk/factorio-tnfp-betarelease/blob/master/TrainNetworkForPlayers_0.11.4.zip

The circuit conditions are now globally applied rather than per-player and I've tweaked up some of the logic for redispatch so once a request completes for the player it stays active for the train -- so the circuit conditions can still apply. This should then be cleaned up when the train leaves the station, though theres some edge cases I probably need to consider.

I need to take a bit of a deeper look into the logic around redispatching though. After a trains been sent to a player and they board it, the train schedule is reset back to its original state and swapped to manual mode before the station selection dialogs opened -- that way the schedules clean for the redispatch and it can wait safely for the player to pick a destination.

Unfortunately that also means once it has a destination it will just immediately leave, circuit conditions be damned. The answers probably to add both the pickup station and destination into the new schedule to enforce circuit conditions, but that'll then trigger some arrival logic -- so I need to have a play around with that one. Hopefully, I should get some time for that this week though

Cheers, Lee H

4 years ago
(updated 4 years ago)

In case it helps at all, here's the blueprint string for the station that I'd like to use with this mod. You might find it helpful for testing.

0eNrlm01u4zYYhq8y4KotpED8ESka6CxmM7tBgc6uCAzZohMCsmxQcto08AF6i56tJykpO5YiixZpE5023TiQJT4k3/fjJ/44L2BR7sRWyaoBsxcgl5uqBrNfXkAtH6q8NN81z1sBZkA2Yg0iUOVrc6VyWYJ9BGRViN/ADO6j6SJiJStRxI/577kqYl3TUolG9CjIgfKQvymCHYo0urFVXDebba8g2d9HQFSNbKQ49Li9eJ5Xu/VCKN2lU3ldshLxr3lZauZ2U+sim8rUZpqc4bs0As9gFiNM7tK9ac+AhBxJ6SQJO5LIJIk4kuhbUgS0bY3alPOFeMyf5EaZJ5dSLXeymW+2opq3Bs0atRPR6YYSeTGvRVWb582tA6gSS1NZbRjQfDwoIaq+GbIAM9ZrvrmGeH+/H+tT+jZIRnrDhr0ppDq04Rh8AyKdJGaeROaoO//2upOh7lkHNtdocB9Biy+ZW595Mhm13JEEJ0kwcUShaZRrpuihsAWF/JOODYX9UShgpHW3NK84Vb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qZB1E2Dqtu+BK+m0CAe0SAe0SAe0SAe0SAe0SAesSAesSAesSAesSAesSAesSAeZUE8yoJ4lAXxKAviURbEoyyIRzyIRzyIRzyIRzyIRzyERzwJoW5HwUEoKAgFBqEEUfemEdDt65MgFByEgoJQYBBKEoLi7pFenbQ/oJ/1/jcgAmW+EHoNDM42CJ6Eqg8bHRkkjHBGGUxoSvf7vwHgJguz

I can think of only two approaches for the problem you described. I'm pretty sure you have no choice but to add the pickup station to the schedule. Either you can tell that the temporary stop is just there for the circuit conditions and shouldn't be be considered as an arrival by inspecting the train's schedule (or any other properties that might make the distinction), or you use a piece of state tucked away somewhere to keep track of what that train is doing at that moment. The former would be easier to get right, assuming that it is possible. You could maybe make it possible by intentionally doing something to the train's schedule or something.

EDIT: I can't seem to figure out how to do spoilers. Where is the formatting documentation for this forum-like interface?

New response