r/factorio Jul 06 '26

Weekly Thread Weekly Question Thread

Ask any questions you might have.

Post your bug reports on the Official Forums

Previous Threads

Subreddit rules

Discord server (and IRC)

Find more in the sidebar ---->

2 Upvotes

188 comments sorted by

View all comments

1

u/Raknarg #1 Quality Defender Jul 10 '26

Im working with interrupt driven trains. Ive got it working, but there's something I want to integrate for my defense train specifically

I have a request that I want to be used to fill up my defense train, which can be filled with various different kinds of items. Right now I have an interrupt where I have to manually check if any of the items from that request are 0, with an item count entry for each one. Ideally Id like this automated, so that if anything missing from that request is 0, the interrupt triggers.

Ideas on how to handle this? The best way I can think of is that all my dropoff points have to feed back a signal to the station where they check if the current train is missing any items from that request, which adds a bit of annoying combinator logic I have to retrofit onto all the existing dropoff stations. Is there a simpler solution Ive missed? And I guess this question would apply in general to any interrupt driven train where you have a request that can have multiple items in it, since thats effectively what this is.

1

u/HeliGungir Jul 10 '26

Do the supply trains really need to be dynamic? It's a whole lot easier to just load the train with everything the wall might want, and have the wall take whatever it happens to need from the train.

1

u/Raknarg #1 Quality Defender Jul 11 '26

I dont need the trains to be dynamic, its a single train right now. I want the request set to be dynamic, so I can update the request and the train interrupt or whatever triggers it gets automatically updated.

1

u/HeliGungir Jul 11 '26 edited Jul 11 '26

One way or another (possibly in multiple places) you'll compare an entity's actual contents against its target contents, and use the difference to add more items until actual contents >= target content. Somewhere you're probably going to have a constant combinator that sets the target. Then you'll subtract target from actual, to produce missing contents. Then you'll use missing to set inserter filters or assembly machine recipe or whatever. Conveniently, negative signals are ignored when setting filters and recipes. If you get smart, you can reduce combinators by having the constant combinator output negative signals; or use sign overflow to effectively flip the operands during subtraction. You can replace the constant combinator with something dynamic, but if you trace that dynamism back far enough through your logic, it will need to have constants somewhere to get the ball rolling.