Page 1 of 1

Inserters feeding into train act before station can report signals.

Posted: Wed Dec 17, 2025 7:44 pm
by hanli427
Inserters feeding into a train will react and begin inserting before the station has a chance to report on signals from the train.

I have a set of filtered inserters set to insert into a train. The filters are set based on what is inside the train, which means I have to read the contents of the train and run the values through a set of combinators from which the filters are set.
However, when there is no train at the station the rest of the circuit is still active and provides a set of filters for the inserters, which are different when there is no train in the station. This should not be a problem since as soon as the train arrives the filters are set correctly, except for the very first tick on arrival. There is one tick just when the train arrives when the inserters are active with the old filters which lets them do one swing inserting incorrect items and messing up the train cargo.
I was able to get around the problem easily by deactivating the inserters unless there is a train present, specifically the final decider combinator setting the filters also checks the train ID before outputting anything. But I think inserters should not react before the station has a chance to report signals from the train.

Re: Inserters feeding into train act before station can report signals.

Posted: Wed Dec 17, 2025 9:44 pm
by torne
Having a decider that checks the train ID as you mention is the usual solution for this problem in practice.

It seems like it would be very difficult or impossible for the game to reliably prevent this from happening itself, because you can have whatever combinator logic you want at your station. Delaying the inserters' activation until the station starts outputting the train contents would only solve the issue if the station is connected directly to the inserters with no combinators in between, because each combinator in a chain delays the signal by one tick to do its calculation - if I had a very complex station setup the inserters might need to be disabled until, say, 2 or 3 ticks after the station has started to output the train contents.

Re: Inserters feeding into train act before station can report signals.

Posted: Thu Dec 18, 2025 4:56 pm
by jdrexler75
Another thing to consider, and which has bit me far too often than I care to admit, is that the enable and filters only work during pickup. If the train becomes full, or leaves the station, the inserter will complete its swing anyway and then wait to drop its hand contents into the next train that stops, regardless of enable/disable or filters allowing it or not.

The most reliable solution I found for this, was to have one inserter with the same filter signal but set to blacklist, to remove these items from the train again...

Re: Inserters feeding into train act before station can report signals.

Posted: Thu Dec 18, 2025 6:39 pm
by Tertius
To avoid the train becoming full and an inserter with a full hand is staying full until the next train, you need to carefully include the train content into your calculation and set the stack size of any item an inserter should move into the train. The OP described how to do this: subtract current train content from wanted train content.

Inserter config can be implemented by selecting 1 item from the items to move (result from the subtraction), get the corresponding amount into a S (stack size) signal and supply this item as filter to the inserter as well as the stack size signal. This way the inserter will never try to move more items into the train than it should.