Page 1 of 1

Additional train interrupt conditions

Posted: Thu Oct 24, 2024 6:07 pm
by DocJade
TL;DR
Having more conditions for limiting / triggering interrupts would open up a lot more amazing (and stupid! :lol: ) possibilities.

What ?
Train interrupts are EXTREMELY powerful :D , but a couple more conditions could really kick things up a notch, here's what I would find useful / could see being useful:

- Has fluid wagon: Does the train that the interrupt is triggering on have a fluid wagon? Useful for generic train dispatching systems, yes you can check manually with inserters and some additional logic, but that has caveats.

- Has cargo wagon: Ditto

- Cargo wagon count: Mixing train sizes on the same network is cool! If you're using the same interrupt on multiple train configurations, it would be nice to differentiate them somehow. Especially since Interrupts are not train group specific, you end up with a lot of duplicated interrupts if you want to use different logic for different train sizes.

- Fluid wagon count: Ditto

- Locomotive count: Ditto

- Trains on the way to station / station is empty: If there are trains already heading to the station, It would be useful to be able to detect that from inside the trains, so you can avoid sending 10 trains to the same stop at once. Yes train limits can be used, but having trains on the way is slightly more nuanced, especially if you are using bidirectional trains, where there might not be a open path to the station until the trains on route have fully arrived!

- Has priority / priority conditional: Being able to set a priority threshold would be cool, you could have 2 separate fleets of iron trains that are only activated when priority passes a threshold. Imagine a iron unloading station that increases its priority based on how much ore it has left in its buffer, and you can have a specialized fleet of trains that use higher quality fuel, which _only_ deliver to the station if the priority passes a certain point. IE [station] has priority [comparison] [number or signal value]

- Damage taken: Like space platforms, if a train is taking damage, you usually want to get it outta there ASAP!

- Time passed: Lots of people use inactivity in their unloading stations, but there is times where a train is sitting at a station, and being unloaded _very_ slowly, even though it would be better off going to another station to continue delivering items. Being able to set a hard cap with an interrupt could be useful, especially for stations where you are storing your trains depot style. Ever had a train end up stuck behind another train in a stacker, because the train in front of it has already "left" the station, but has been waiting to pathfind somewhere for 10 trillion years? An interrupt on that train in front to go to another "im idle" station would be useful!

- Has open path: This might be a stretch due to the performance hit of tons of trains doing path calculation when using this condition, but knowing if a train _can_ get to a station from where it is would also be very useful. Only being able to check _after_ a train leaves is a tad annoying, since the train would have to trip a second interrupt. _Or_, if you could allow players to invert the `Destination full or no path` condition.

- Distance: Set a maximum (or minimum!) Distance between the train and the desired station, IE [station] distance is [comparison] [number or signal value]. Imagine having a station on the other side of your base, but you know you need to have x fuel to go x distance, before sending the train, you could validate that the train can make it there and back without running out, or use a train with less cargo wagons to get there faster!

- Fuel level: Being able to check fuels is probably the most powerful part of the interrupt system :D , but you end up with several `or` statements in a row to check multiple types of fuel. Doing `fuel wildcard` < 50 works great for coal, but when you switch to using uranium in a train, that would trigger every time. A "fuel level" interrupt would allow you to send a train to a station if it is [comparison] [number or signal value]% full on whatever fuel item it is carrying. IE <33% would trip on 200 spoilage, 50 coal, 20 rocket fuel, or 1 nuclear fuel.


Why ?
The more ways you can interact with the interrupt system, the more cool things you will be able to do! 8-)
Train got blown up? Send it to the graveyard.
Station is too far away? Don't go there until you have a full tank of gas!
Station has low priority? Eh, :roll: somebody else can do that.
Don't have a fluid tank? Then don't go to the oil pickup station!

Re: Additional train interrupt conditions

Posted: Thu Oct 24, 2024 6:23 pm
by lenanya
real this sounds baller

Re: Additional train interrupt conditions

Posted: Thu Oct 24, 2024 6:30 pm
by dcohen8128
+1 to all of this.
- Has fluid wagon: Does the train that the interrupt is triggering on have a fluid wagon? Useful for generic train dispatching systems, yes you can check manually with inserters and some additional logic, but that has caveats.

- Has cargo wagon: Ditto
I don't think just this would be sufficient for a generic dispatch, assuming you're using circuit signals to trigger the interrupt. I think the ability to test if an interrupt circuit condition signal parameter is an item or a fluid would help with that.

Re: Additional train interrupt conditions

Posted: Thu Oct 24, 2024 7:32 pm
by DocJade
dcohen8128 wrote:
Thu Oct 24, 2024 6:30 pm
I don't think just this would be sufficient for a generic dispatch, assuming you're using circuit signals to trigger the interrupt. I think the ability to test if an interrupt circuit condition signal parameter is an item or a fluid would help with that.
Agreed! More options is always better.
I think letting the trains check if a signal is a fluid is a bit too far, since that's selector combinator territory IMO

If train stations could output what kinds of wagons are on the train, that would be cool, but that would be another 4 signal types, or it would output the items which would collide...

Re: Additional train interrupt conditions

Posted: Thu Oct 24, 2024 8:27 pm
by 4wry
Especially for interrupts the following would be useful:
  • Next destination is free
  • Next destination is full

Re: Additional train interrupt conditions

Posted: Thu Oct 24, 2024 9:57 pm
by Niizuki
"Minimal priority" would be nice

Re: Additional train interrupt conditions

Posted: Tue Oct 29, 2024 12:07 am
by LightThemeIDE
Having a signal that says a train is on the way would make things so much nicer

Re: Additional train interrupt conditions

Posted: Tue Oct 29, 2024 3:13 pm
by Dark_Wynd
I completely agree with these suggestions.

Considering that, currently, fuel is only measured by Item Count, the Fuel Wildcard being used in Interrupt feels useless given the variable stack size & efficiency of various fuel types. Being able to either count complete stacks of fuel in locomotives OR total Joules value in any (or all) locomotives would be be a great way to make that Fuel Wildcard more meaningful!

Re: Additional train interrupt conditions

Posted: Wed Oct 30, 2024 5:51 pm
by snizzle810
I was surprised to find that inactivity was not an available trigger condition for interrupts, since its already available as a train stop condition.

edit: turns out I don't know how interrupts work, they only check on station leave, not continually.

+1 for more options!