Page 1 of 1

Cloned entities ignore conditions for their first tick

Posted: Fri Sep 04, 2020 10:31 am
by Atraxi
When cloning some entities the new copies appears to ignore any conditions for their first tick. Primarily an issue for mods, but the underlying issue is entirely reproduced in vanilla 1.0 with the editor.
I've tested belts and inserters, and interestingly pumps don't appear to be affected. I haven't tested it on any other entity types yet.

Before cloning:
Inserter before.png
Inserter before.png (500.98 KiB) Viewed 2427 times
After cloning:
Inserter cloned.png
Inserter cloned.png (428.72 KiB) Viewed 2427 times
Before cloning:
Belt before.png
Belt before.png (579.32 KiB) Viewed 2427 times
After cloning:
Belt cloned.png
Belt cloned.png (574.25 KiB) Viewed 2427 times

Re: Cloned entities ignore conditions for their first tick

Posted: Fri Sep 04, 2020 3:30 pm
by Rseding91
That's working correctly. The circuit network has no values the first tick because the live state of the network is not cloned: just the entities are.

Re: Cloned entities ignore conditions for their first tick

Posted: Fri Sep 04, 2020 4:04 pm
by Atraxi
Just to clarify in case it helps modders attempt a workaround, when you say "has no values" do you mean null or undefined rather than just zero'd out? As the intended before and after state in the demo setup is that the network has no signals with the entities configured to be inactive in any feasibly reachable state.

Re: Cloned entities ignore conditions for their first tick

Posted: Fri Sep 04, 2020 4:05 pm
by Rseding91
Atraxi wrote: Fri Sep 04, 2020 4:04 pm Just to clarify in case it helps modders attempt a workaround, when you say "has no values" do you mean null or undefined rather than just zero'd out? As the intended before and after state in the demo setup is that the network has no signals with the entities configured to be inactive in any feasibly reachable state.
I mean it's a completely new circuit network and has no live values. Everything sends their state during the creation tick and then the next tick it gets swapped into the live values and the system repeats itself. It's now circuit networks work.

Re: Cloned entities ignore conditions for their first tick

Posted: Fri Sep 04, 2020 6:04 pm
by sparr
If the network had no values then the "value < 0" filters would keep things disabled, but the demonstrations here are of "value < 0" filters being true and/or ignored for the first tick. This seems to be something more than just the values not being present.

Re: Cloned entities ignore conditions for their first tick

Posted: Fri Sep 04, 2020 9:28 pm
by Rseding91
sparr wrote: Fri Sep 04, 2020 6:04 pm If the network had no values then the "value < 0" filters would keep things disabled, but the demonstrations here are of "value < 0" filters being true and/or ignored for the first tick. This seems to be something more than just the values not being present.
The belt is active for the first tick and updates independent from the control behavior. In the same way if you create-entity a belt and in the same tick create the control behavior and set the condition it still updates once before the control behavior disables it.

Re: Cloned entities ignore conditions for their first tick

Posted: Fri Sep 04, 2020 9:31 pm
by sparr
OK. Thanks for clarifying that. It still feels like a misbehavior, but at least knowing what's causing it behind the scenes makes it more predictable. Is there any way to explicitly and unconditionally prevent such an entity from operating on tick one from within the mod that creates it, to give the conditions time to take effect?