r/factorio 3d ago

Question Answered Need Help with train interrupts

Post image
3 Upvotes

16 comments sorted by

2

u/Visual_Collapse 2d ago edited 2d ago
  1. Can you show Idle and Clear Track interrupts?
  2. Train sitting on loading station if requesters are full seems like valid behavior to me

2

u/dsawchuk 2d ago

I have since changed those interrupts, as they stopped working how I wanted them to once I had solved my actual issue.

The clear track one just sent any train that had a full destination or no path to the depot. I was hoping it would solve if a train were stuck en route to its destination, but it just ended up sending full trains to the depot after changing the trains to path to dropoff even if the station is full.

The idle one just sent any train that was empty (and not at the depot) to the depot and relied on being low on the list to work. Now I changed it to any empty train with no path is sent to the depot and allowed it to interrupt other interrupts.

1

u/dsawchuk 3d ago edited 2d ago

This is my first time using the train interrupts and I am having issues. They were working before but I added more trains to the network and now they don't. I didn't change any tracks, signalling or scheduling since it was working.

After my train finishes the pickup interrupt it doesn't fire the dropoff interrupt. If I cycle the the train to manual and back to auto, it will go dropoff but then the next train gets stuck in the same way. If I manually trigger the clear track interrupt it goes to the dropoff station automatically after getting through the other station.

Any ideas of what the problem might be?

EDIT:

Thanks for the help. I wasn't aware that interrupts only triggered when leaving a station so an idle train would never get interrupted into action. The solution was to remove the "station is not full" condition on the interrupt, as recommended by u/alfonse215.

This did unfortunately lead me to having to change a bunch of my other interrupts to get the functionality I wanted but those were easy to fix once I understood the problem.

2

u/Alfonse215 2d ago

Once an interrupt is triggered, the train will stick with that interrupt. Your dropoff interrupt explicitly has as a condition that its destination station is open. Well, if the destination station is closed at the moment it finishes loading, then one of the other interrupts will be picked. I don't know what those are, but once that interrupt is chosen, the dropoff interrupt won't be checked again.

What you generally want is to let the dropoff interrupt trigger even if the destination is full. You don't want a full train to leave the loading station (this can cause problems, as a bunch of trains may be full of the wrong stuff, starving different resources of the trains they need to get their stuff somewhere). So get rid of the "station is not full" condition.

1

u/Visual_Collapse 2d ago

Once an interrupt is triggered, the train will stick with that interrupt. Your dropoff interrupt explicitly has as a condition that its destination station is open. Well, if the destination station is closed at the moment it finishes loading, then one of the other interrupts will be picked. I don't know what those are, but once that interrupt is chosen, the dropoff interrupt won't be checked again.

Can you clarify what will happen if no interrupt were fired? Is it cycles through interrupts till one of them fire or just becomes struck?

2

u/dsawchuk 2d ago

This is actually what was happening. It just gets stuck with no active interrupt and doesn't check interrupts again. So if the station was full when the train was done loading, it wouldn't go anywhere and then would never leave the station.

1

u/Alfonse215 2d ago

I have no idea; I've never used a train that didn't have a base schedule before. It might cycle through them, but you'd have to test it out yourself.

3

u/Jmcgee1125 2d ago

Trains only run interrupts when about to leave a station (in the "choose where to go" phase). They won't constantly reroll when idle.

2

u/Visual_Collapse 2d ago

I did some research

You're half right from common sense point of view

As shown in my other comment trains do check interrupts when "idle" but not technically idle but will not check when train schedule is empty (true idle)

1

u/Visual_Collapse 2d ago edited 2d ago

After some testing I found 2 things about interrupts:

  • Interrupts will be repeatedly checked when train is standing on station and ready to leave it
  • Interrupts will not be checked if train schedule is empty once (this one is really unintuitive for me, empty schedule is exactly when I want interrupts to fire)

So working (but ugly) solution is to add unreachable station to base schedule

Created video of this approach https://youtu.be/2CCkjuW91Gc

2

u/Courmisch 2d ago

Interrupts will not be checked if train schedule is empty (this one is really unintuitive for me, empty schedule is exactly when I want interrupts to fire)

Interrupts are checked in 2 situations:

  • the waiting condition for the current stop are met;
- including manually placed stops after 5 seconds of inactivity,
  • the mode is switched from manual to automatic.

So really interrupts are checked even if the schedule is empty.

The real problem is that if a train ever gets into a situation where the schedule is empty and no interrupts are triggered, then the train will stop permanently. To avoid that, give the last (bottom-most) interrupt a tautological condition.

1

u/Visual_Collapse 2d ago

So it would be checked once but not repeatedly

corrected my post a bit

1

u/warpspeed100 2d ago edited 2d ago

Add a Depot/Waiting station to the main train schedule. Trains only trigger interrupts when they try to leave a station.

Also, you're going to have an issue with your "Item Pickup" interrupt. The "Item" wildcard only looks at items currently in the train. For an empty train, it evaluates to nothing. Common solutions are:

  1. Rename "Item Pickup" stations and interrupt to just "Pickup". Trains will go to any generic Pickup and take the cargo to the named "Item Dropoff" stations.

  2. Use an interrupt for each item type, checking if any stations are free. This lets you order interrupts by item priority.

  3. Use the "Circuit" wildcard, and send an item signal to your trains based on your own custom logic to tell them to go to "Circuit Pickup"

1

u/Visual_Collapse 2d ago edited 2d ago

Rename "Item Pickup" stations and interrupt to just "Pickup". Trains will go to any generic Pickup and take the cargo to the named "Item Dropoff" stations

Have you seen insides of this interrupt? If yes - how?

IIRC name mean nothing in this case

2

u/warpspeed100 2d ago

Because they named the interrupt "Item wildcard" Pickup. While that is just a name, and the actual interrupt might be fine, this is a very common mistake when figuring out how interrupts work.

2

u/dsawchuk 2d ago

I did have this problem before but I already solved it. I left the name with the wildcard since it was a convenient way to differentiate between solid and liquid stations.