Pence128 wrote: Thu Nov 25, 2021 8:45 am
As far as I can tell in tick 2 the inserter decides that it's going to
try to swing in tick 3, circuit network be damned. It's only really disabled for tick 4. Maybe this is to preserve the 1 pulse = 1 swing functionality that everyone depends on.
I think this is a closer depiction to what happens than " inserter swinging before checking signal". It would be "inserter swinging AFTER checking signal".
With the counter-intuitive addition of train logic.
In my mind it makes sense to consider a tick as a duration. Then you have the start of the tick, as an edge, and the end of the tick, those are not duration.
A train arrive during a tick. [Tick 0]
At the end of the tick the game prepare a list of the inserters that are loading/unloading on this train to activate next tick. ( this is like the total of changes occuring during the tick, it need to be computed "at the end of the tick".)
At the beginning of the next tick, those inserters are awake, and the train station start output a signal. [tick 1]
During this tick 1 the inserter
has not yet received the signal from the station like the train content, but it already knows there is a train that's why it's written "waiting for source item" and not "waiting for a train" anymore. This is counter intuitive i think because the tooltip has a red dot associated with the state of the inserter, while at the same time the little lamp at the circuit connection on the inserter is green. During this step you can read the train content on the circuit network, but the inserter hasn't processed it yet. Instead the inserter still holds the previous tick value of circuit network, with 0 landmines in your example, 0<100 for the inserter.
At the end of this [tick1] the game prepare a list of the inserters that enable/disable the following tick based on the signal that was received during this tick. The inserters think it has all good reason to grab something next tick because during the whole tick it had 2 ok condition, 1)a train 2) nothing yet in the circuit network. maybe here the inserter does a mistake because it WILL grab something next tick. Despite the circuit counter order.
Now begining of [tick 2] The inserter grabs something in the chest, because there was a train incoming previous tick and no circuit counter-order yet. And gets disabled for the rest of the duration of the tick due to circuit. So it's again a bit counter-intuive because the little lamp on the inserter has become red during this tick but the inserter just grabbed something. The lamp color "lag behind". by 1 tick to the real behavior. This is because circuit value changing during a tick only apply the following tick. So the lamp is now showing red, but the inserter has grabbed something.
Next tick the inserter is disabled by circuit still the lamp is red. But in the screenshot example the inserter grabbing from a chest to a wagon only require 1 pulse of activation to generate a full swing. The item being grabbed the tick AFTER the activation was received, and the full swing being ordered will complete even if you cut power
. The item was grabbed at the begining of the previous tick, so the swing will now complete.
The train logic is the counterintuive part because it's "faster" than the circuit one (imo) i think it is a special that can reasonnably induce the misunderstanding.
- 1tick delay.png (735.67 KiB) Viewed 5419 times
On this little test setup you can see that the inserter on the left side "shouldn't" grab anything. right ? deactivate as soon as there is a train ? but really it's deactivating as soon as there is a signal T, the inserter seing the train for a train faster than the inserter is seing the train from the signal T.
The other inserter on the right side can't see the train for a train, it only sees the signal T. This is why it lags behing by 1 tick. It is now activated ( on the screenshot), but it didn't have the time to grab concrete, it will do so only the following tick. ( Hence why i started saying the inserter swing AFTER checking signal).
The 1rst inserter on the left side has already some concrete in hand, due to seeing the train the previous tick, without receiving counter-order ( during the previous tick only at the end !). It is now deactivated by circuit, but it's too late it started the tick by grabbing something as the result of the previous tick.
In other word " the signal T condition" triggers at the same time for both inserters, causing them to react 1 tick later. But the inserter on the left side has a different behavior than the one on the right side due to being next to a rail and able to interact directly with the train.