Lua event for assembler state

Place to get help with not working mods / modding interface.
Post Reply
Fatmice
Filter Inserter
Filter Inserter
Posts: 808
Joined: Thu Dec 04, 2014 11:03 pm
Contact:

Lua event for assembler state

Post by Fatmice »

I did much searching but did not come up with anything useful. I would like to know if there is an event that can trigger when an assembler-type within the glob table finished crafting.

The problem has to do with fluid recipes where fluid temperatures are important. Currently, a fluid when crafted will always have a default_temperature as defined for that fluid. To mitigate this, ontick event has to be used with a tick counter, set to some tick interval, to loop through a glob table of with the entities crafting the fluid and modify the temperature of the output fluidboxes. The problem with this approach is that the tick interval must be small, between 5-7 ticks, so as to not "miss" when the crafting entity finished the recipe. If the tick interval is too small, as in every tick, then there is wasteful checking of the state of the fluidboxes in those entities.

Is there a way to catch when an entity finished crafting within the current modding framework? If not, would it be easy to add an event.watchlist such that when a registered member on that list meets a criteria it will execute some code? Entity state would like be useful in this matter?

Entity state can be inferred through some method and properties but only for when it's working, but not when it just finished working.
Maintainer and developer of Atomic Power. See here for more information.
Current release: 0.6.6 - Requires 0.14.x
Example build - Requires 0.14.x

mrtux
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Thu Dec 04, 2014 10:04 pm
Contact:

Re: Lua event for assembler state

Post by mrtux »

+1

I am missing an event for recipe changes in the assembler.
If only my thesis could be done in Factorio …

Post Reply

Return to “Modding help”