Factorio

Factorio

View Stats:
Chuck Nov 3, 2024 @ 11:37pm
Interrupt check destination?
Im having a hard time with a "queue" interrupt that i want to set up. Basically if the train's destination is full, go to the queue, wait a bit, and then check the destination again. I cant seem to figure this out, is there a way i can do this? Im stumped here.

I know i can start the interrupt with a check if destination full thing, i just dont know how to keep the train there until the destination is no longer full.
Last edited by Chuck; Nov 3, 2024 @ 11:38pm
< >
Showing 1-5 of 5 comments
strongled Nov 4, 2024 @ 12:01am 
It worked for me exactly as you're asking when I made the condition: "X is full" and then add the parking/queue/depot station with "X is not full" in "waiting conditions".

I know I've made the same mistake like you several times, forgetting to add a waiting condition in my interrupts.

EDIT: You might have issues with certain situations.
E.g. a train that gets ore finds that the ore station is unavailable.

In that case, I would add "cargo is not full" AND "ore station is full". And vice-versa for trains that would go for plates where the plate requester is full.
Last edited by strongled; Nov 4, 2024 @ 1:08am
Chuck Nov 4, 2024 @ 8:41am 
Its just not working that well for me. What i did:
Queue interrupt:
When destination full or no path > queue station
Major (wildcard) depot is not full
and
(wildcard) =/= 0
or
empty cargo inventory
and
major (wildcard) mine is not full

theoretically, this should be "if the depot isnt full and you have ore, or if you dont have ore and a mine isnt full, end interrupt" But the trains are all empty and they wont go to the mine.

I used to only queue trains for depots, because i had 2 mines and 2 trains, so if they needed to queue is was probably because the depot was full, so I only had to check the depot, but now I want to be able to queue for both mines and depots.

My problem might be that im trying to make 1 "universal queue" signal thats used on both the copper and iron trains, and that might not be possible with how my trains are set up.
Originally posted by strongled:
In that case, I would add "cargo is not full" AND "ore station is full". And vice-versa for trains that would go for plates where the plate requester is full.
Im only using trains for ores and ore drop offs. Looking back, I shouldve built the factory to do that, but it just isnt designed to have plates being put directly on the bus from a train. Ill probably eventually move the furnaces away from the factory, have ore trains deliver the ore to them, and then have the plates trains bring them closer to the bus, but right now, thats just not how the factory operates.
Last edited by Chuck; Nov 4, 2024 @ 8:44am
Chindraba Nov 4, 2024 @ 9:20am 
I'm not yet to the trains in 2.0 so I can only give a theory about what might be the issue.

It looks like you are expecting the interrupt to "fire" at a specific point in the schedule. Something like "at this point make a choice." That is not how they work, and how the name came to be chosen.

An interrupt can happen any time. In the case of Factorio, the interrupt conditions are checked, iirc, just as the train is ready to leave a train stop. The first one which is true will happen, and run all the way to the end of the interrupt (unless there is also the special interrupt in interrupt set). After the steps of the interrupt are done the train's schedule will be reset to just after the check happened, like it never happened. If you ever watched it happen in 1.1, it would be the same as when you Ctrl+click to add a temporary stop. The train schedule gets that stop inserted between where it was and where it was going. It goes to the temporary stop, waits 5 sec, deletes the temporary stop and then tries to go to where it was going.

What could be happening is that the interrupt is triggering some time other than you expected and the results end up placing the train in a spot in the schedule which doesn't make sense and it waits on some other condition than you expected.
bugfix Nov 12, 2024 @ 3:30pm 
Originally posted by Chuck:
Its just not working that well for me. What i did:
Queue interrupt:
When destination full or no path > queue station
Major (wildcard) depot is not full
and
(wildcard) =/= 0
or
empty cargo inventory
and
major (wildcard) mine is not full

theoretically, this should be "if the depot isnt full and you have ore, or if you dont have ore and a mine isnt full, end interrupt" But the trains are all empty and they wont go to the mine.

I used to only queue trains for depots, because i had 2 mines and 2 trains, so if they needed to queue is was probably because the depot was full, so I only had to check the depot, but now I want to be able to queue for both mines and depots.

My problem might be that im trying to make 1 "universal queue" signal thats used on both the copper and iron trains, and that might not be possible with how my trains are set up.
Originally posted by strongled:
In that case, I would add "cargo is not full" AND "ore station is full". And vice-versa for trains that would go for plates where the plate requester is full.
Im only using trains for ores and ore drop offs. Looking back, I shouldve built the factory to do that, but it just isnt designed to have plates being put directly on the bus from a train. Ill probably eventually move the furnaces away from the factory, have ore trains deliver the ore to them, and then have the plates trains bring them closer to the bus, but right now, thats just not how the factory operates.

Just stumbled upon your post trying to solve similar issue - several trains between depot and mines, and wanted to have schedule and a wait queue with interruptions.

Actually I did it just and solely through interruptions! No schedule at all for every given train.

1. every station better have train limit set
2. queue stations should be in a fairly big quantity
3. for every train there are two stations, one where cargo loaded and one where it is unloaded, also there is one refuel station on the map.
4. now to interruptions:
*) wait in queue
condition: if no destination full or no path
target: go to queue station, with empty wait condition!
*) refuel
condition: if some fuel low
target: go to refuel, all loco refueled wait condition
*) Load <cargo> from <place type> ( these interruptions are numerous like
"Load Copper Plate From Depot", or "Load copper Ore from Mine" etc.. )
Let's assume I collect from copper mine:
condition: if empty cargo
target: go to Copper Mine, wait until cargo is full
*) Unload <cargo> at <place type> ( the same these interruptions are numerous like
"Unload Copper Plate @ destination", or "Unload copper Ore @ Mega furnace" etc.. )
Let's assume I drop copper ore at furnace:
condition: if full cargo
target: go to Copper Furnace station, wait until cargo is empty

That's all. For any station where there is a limit of trains or for which you disable station upon any given signal this will work.

Now to create a new train you chose a corresponding pair of cargo interruptions, and add queue and refuel interruptions.

Just be carefull - if train went to half loaded condition and somehow stopped, run load or unload interruption manually so it would be back to consistent state.

one thing though is harder now - you better set the group for each train, as their designated stations would appear dynamically - depends on current interruption - so that train management become harder now.
Simon Nov 12, 2024 @ 3:42pm 
Do you know there's multiple ways to check if a station is full? You setup a condition that triggers if the train can't go to the station because it's full. You can also check if the target station itself is *not* full as condition to going to said station.

This will prevent the interrupt from activating at all, and keep your train at whatever station you want to keep it. You want to make whatever station the train is waiting at a timer, so every 10 seconds or so the train checks again if the destination is full, and you want to keep this loop again otherwise it might get stuck on "heading to destination" or something, which will never fire another interrupt until he actually ends up in that station.
Last edited by Simon; Nov 12, 2024 @ 3:43pm
< >
Showing 1-5 of 5 comments
Per page: 1530 50

Date Posted: Nov 3, 2024 @ 11:37pm
Posts: 5