Depot trains acting weird

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
jaylawl
Fast Inserter
Fast Inserter
Posts: 175
Joined: Sat Nov 23, 2024 10:14 am
Contact:

Depot trains acting weird

Post by jaylawl »

Why do my depot trains act like this and how can i prevent it?

https://gyazo.com/87ae539d099e11be1d416bf0bcf5e15d

Setup:
depotSet.png
depotSet.png (120.12 KiB) Viewed 781 times
mmmPI
Smart Inserter
Smart Inserter
Posts: 4084
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Depot trains acting weird

Post by mmmPI »

Without a savefile it's quite difficult to guess what is happening. It's also difficult to understand what you wish to have the trains do.
Muche
Smart Inserter
Smart Inserter
Posts: 1006
Joined: Fri Jun 02, 2017 6:20 pm
Contact:

Re: Depot trains acting weird

Post by Muche »

They seem to be at the depot, the interrupt is triggerred, they wait 5s, then the cycle repeats.
I've seen suggestions to incorporate "At specified station/Not at specified station" in the interrupt's condition.
jaylawl
Fast Inserter
Fast Inserter
Posts: 175
Joined: Sat Nov 23, 2024 10:14 am
Contact:

Re: Depot trains acting weird

Post by jaylawl »

mmmPI wrote: Sun Jan 05, 2025 2:10 pm Without a savefile it's quite difficult to guess what is happening. It's also difficult to understand what you wish to have the trains do.
I want the trains to do exactly what they are doing right now: go to depot if they are not needed and check every 5 seconds if they can go somewhere else. But that weird opening/closing behaviour along with the accompaning sound effect makes it weird and feel like i have not done this in an intended way. The sound effect gets terribly annoying if i am near the depots.
Muche wrote: Sun Jan 05, 2025 3:51 pm They seem to be at the depot, the interrupt is triggerred, they wait 5s, then the cycle repeats.
I've seen suggestions to incorporate "At specified station/Not at specified station" in the interrupt's condition.
How do people usually implement this in their depot interrupts?
Tertius
Smart Inserter
Smart Inserter
Posts: 1167
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Depot trains acting weird

Post by Tertius »

I do it like Muche suggested. Exclude the depot from the depot interrupt.

I use depots for empty trains. My trains have one default schedule entry: "go to loading station". The depot interrupt triggers for "destination full". So if the train is empty and tries to go to its default schedule, and every loading station is full, the depot interrupt triggers and the empty train gets directed to the depot. The interrupt only adds a waiting condition of "inactivity 5 seconds" at the depot, just like yours.

The only valid destination from the depot is the static schedule entry, the loading station. However, if it is full, the train doesn't need to be directed to the depot again, because it is already there. So I added an additional condition to the depot trigger: "... AND not at depot station". This way the depot interrupt will not trigger if the train is already at the depot. Instead no interrupt is triggered and the train goes to sleep at the default schedule entry as long as no other interrupt fires and all loading stations are still full.

As soon as one loading station becomes open, one sleeping train wakes up and drives to the loading station. No interrupt involved here, it just wakes up and drives according to the default schedule entry.
If the train is full, the next destination is interrupt controlled again. The interrupt detects the cargo that was loaded and adds the corresponding unloading station as temporary schedule. If all unloading stations are full, the "destination full" condition for the depot interrupt will not trigger, because an interrupt will not interrupt an already active interrupt. Instead, the train just sits at the loading station sleeping and waiting for an unloading station to open. But this is ok, because if no unloading station has any demand, there is no need to free the loading station.
Muche
Smart Inserter
Smart Inserter
Posts: 1006
Joined: Fri Jun 02, 2017 6:20 pm
Contact:

Re: Depot trains acting weird

Post by Muche »

It seems it currently may not work as desired in all cases, see 121203 Inconsistent Train Interrupt Condition Handling (Full Destination vs. No Path).
waterBear
Fast Inserter
Fast Inserter
Posts: 101
Joined: Thu Apr 23, 2020 2:05 pm
Contact:

Re: Depot trains acting weird

Post by waterBear »

That's just how trains work. When they're at a stop they open. When they're departing, driving, or arriving, they're closed. What you're seeing is the train opening for 5 seconds while it waits then closing to depart, then the interrupt triggers because they have no destination, then they go to the wait stop (which they're already at), and they open up again.
jaylawl
Fast Inserter
Fast Inserter
Posts: 175
Joined: Sat Nov 23, 2024 10:14 am
Contact:

Re: Depot trains acting weird

Post by jaylawl »

waterBear wrote: Mon Jan 06, 2025 12:08 am That's just how trains work. When they're at a stop they open. When they're departing, driving, or arriving, they're closed. What you're seeing is the train opening for 5 seconds while it waits then closing to depart, then the interrupt triggers because they have no destination, then they go to the wait stop (which they're already at), and they open up again.
Yeah, i got that - but don't you figure that this is undesirable behaviour? I set it to 5 seconds because of a lazy thought. 5 seconds is good enough to never have to worry about it causing UPS issues and good enough for the trains not idling for that long. Make it shorter and you get a symphony of death.

While messing around with that i found a hacky solution: set the time passed condition to 0 seconds. It will try to open the cargo bay doors for what seems like just a tick, but there is no sound effect!
waterBear
Fast Inserter
Fast Inserter
Posts: 101
Joined: Thu Apr 23, 2020 2:05 pm
Contact:

Re: Depot trains acting weird

Post by waterBear »

jaylawl wrote: Mon Jan 06, 2025 6:41 pm
waterBear wrote: Mon Jan 06, 2025 12:08 am That's just how trains work. When they're at a stop they open. When they're departing, driving, or arriving, they're closed. What you're seeing is the train opening for 5 seconds while it waits then closing to depart, then the interrupt triggers because they have no destination, then they go to the wait stop (which they're already at), and they open up again.
Yeah, i got that - but don't you figure that this is undesirable behaviour? I set it to 5 seconds because of a lazy thought. 5 seconds is good enough to never have to worry about it causing UPS issues and good enough for the trains not idling for that long. Make it shorter and you get a symphony of death.

While messing around with that i found a hacky solution: set the time passed condition to 0 seconds. It will try to open the cargo bay doors for what seems like just a tick, but there is no sound effect!
@Tertius suggestion works - I just tried it at my Fulgora wait station. Just add the condition "and not at <wait station>" to the condition "destination full or no path" and your train will sit at the wait station asleep, never opening its doors.

If it really bothers you that much, there's your solution.
vark111
Inserter
Inserter
Posts: 30
Joined: Fri Nov 10, 2023 4:04 pm
Contact:

Re: Depot trains acting weird

Post by vark111 »

For us visual learners:
depot-interrupt.png
depot-interrupt.png (52.93 KiB) Viewed 408 times
Post Reply

Return to “Gameplay Help”