Page 1 of 1

[1.1.76] Inserter does not wake up

Posted: Sat Feb 04, 2023 6:25 pm
by SWeini
Today I stumbled across a salt mine, running out of fuel. After providing fuel it didn't continue without manual intervention. I had to drive there (after many hours not recognizing the issue) and rebuild one of the entities.

This is an issue with a barreling machine (furnace), converting empty barrels and liquid fuel into fuel canisters, which are needed to power the mine.

Once the liquid fuel ran out, the inserter stopped putting the empty barrels into the machine, and when the liquid fuel returned the inserter just stayed inactive.

Expected behavior: After providing fuel (in my case via train) the mine can continue working without manual intervention.

I have attached a small save showing the issue. Let the mine continue working until out of fuel. Then build the ghost of the underground pipe.

I'm pretty sure this has do with the item+fluid recipes in the furnace. You can't even insert the item if the fluid is missing. Don't want to know how many times players were irritated by this. Looks like the game is missing a trigger to wake up the inserter when the fluidbox transitions from empty to non-empty.

Everything working perfectly:
2023-02-04 19_07_41-Factorio 1.1.76.png
2023-02-04 19_07_41-Factorio 1.1.76.png (1.83 MiB) Viewed 2371 times
Running out of fuel:
2023-02-04 19_08_43-Factorio 1.1.76.png
2023-02-04 19_08_43-Factorio 1.1.76.png (1.79 MiB) Viewed 2371 times
Fuel is back:
2023-02-04 19_09_40-Factorio 1.1.76.png
2023-02-04 19_09_40-Factorio 1.1.76.png (1.8 MiB) Viewed 2371 times
Inserter still doesn't want to move:
2023-02-04 19_09_51-Factorio 1.1.76.png
2023-02-04 19_09_51-Factorio 1.1.76.png (70.77 KiB) Viewed 2371 times

Re: [1.1.76] Inserter not activating as expected

Posted: Sat Feb 04, 2023 7:08 pm
by Rseding91
I believe the fix for this will likely be changing the inserter so it can never sleep if pointed at a furnace that supports fluids. There is no event for fluids flowing into or out of a machine.

Re: [1.1.76] Inserter does not wake up

Posted: Sun Feb 05, 2023 5:54 am
by SWeini
This is not good news. This makes it much more difficult to build factories that can restart after ingredient shortage. I've tried loaders instead of inserters, they also get stuck. Or picking up from chest / belt, but they also get stuck. The only workaround I found so far was to add a tank to the fluid system and wire it to the outputting inserter, only allow outputting filled barrels if there is enough fluid left for it to recover. I doubt that this is better UPS-wise. Or change the furnaces to assembling machines, for some reason they don't have an issue.

How do assembling machines deal with this? Observing the show-active-state debug output it looks like they only become inactive when missing items, and staying active, polling their fluidbox, when fluid ingredients are missing. That's probably the same as furnaces that end up with items only, because you added more items than the fluid supports.

I believe the cleanest solution would be to change behavior for furnaces to allow item input while out of fluid. Then the furnace switches to being always active when out of fluid, but not in normal operations (out of items / output full) they can be inactive for quite some time.

Second cleanest solution would be that inserters pointing at fluid-accepting furnaces never become inactive.

Third cleanest solution would be to add a warning to the API documentation about this behavior and contacting developers of overhaul mods to suggest using assembling machines for barreling entities.

Btw, are there furnace entities in vanilla accepting fluids? I believe not. UPS for vanilla could stay the same.

Re: [1.1.76] Inserter does not wake up

Posted: Sun Feb 05, 2023 6:00 am
by SWeini
I just found another workaround, but that ultimately also involves the inserter not being inactive. The active belt keeps the inserter active and adding fluid after running out does reactivate the inserter. I'll probably use this for the time being, but a bugfix is still highly appreciated.
2023-02-05 06_58_26-Factorio 1.1.76.png
2023-02-05 06_58_26-Factorio 1.1.76.png (816.14 KiB) Viewed 2297 times

Re: [1.1.76] Inserter does not wake up

Posted: Sat Mar 11, 2023 11:56 am
by boskid
This issue is really annoying.

I tried making inserter to not go to sleep when furnace is not full. That makes one other test to fail which expects an inserter goes to sleep when trying to insert iron plate to a stone furnace before a recipe for steel is enabled because that test checks if the inserter correctly wakes up when technology is researched.

I was thinking about allowing the inserter to insert the item for which there exists any recipe with fluid, but the transfers to ingredient inventory are size limited by a value taken from a recipe which means it has to select proper recipe in order to not create issues where temporarily selected recipe gives stack limit of 10 item ingredients, inserter goes to sleep and then fluid arrives which is used by a different recipe that requires at least 20 items: in such case the fluid would not cause inserter to wakeup.

I think the only reasonable way of solving this specific case will be if to keep furnace active due to missing fluid and once there is fluid content it would wakeup inputs, worst case in every tick. Most likely the furnace is already active in that case because it should start crafting as soon as there is enough fluid and fluids cannot wakeup that furnace.

Re: [1.1.76] Inserter does not wake up

Posted: Wed Sep 27, 2023 7:58 pm
by Rseding91
I spent some time today and finally found a solution that will keep the inserter from getting into a broken state. It will be fixed for the 2.0 release.

Re: [1.1.76] Inserter does not wake up

Posted: Thu Sep 28, 2023 1:45 pm
by Amarula
Rseding91 wrote:
Wed Sep 27, 2023 7:58 pm
I spent some time today and finally found a solution that will keep the inserter from getting into a broken state. It will be fixed for the 2.0 release.
Thank you, again, to the most unbelievably incredible best development team ever, for another amazing improvement. Rock on!

Re: [1.1.76] Inserter does not wake up

Posted: Mon Oct 02, 2023 5:48 pm
by SWeini
Rseding91 wrote:
Wed Sep 27, 2023 7:58 pm
I spent some time today and finally found a solution that will keep the inserter from getting into a broken state. It will be fixed for the 2.0 release.
I don't believe it. You folks are simply the best! Unfortunately I will continue my Pyanodons game in 1.1 without this bugfix. Just out of curiosity: What's the technical solution that can fix this bug and handle all the edge cases that might still occur?

Re: [1.1.76] Inserter does not wake up

Posted: Tue Oct 03, 2023 1:43 pm
by Rseding91
SWeini wrote:
Mon Oct 02, 2023 5:48 pm
I don't believe it. You folks are simply the best! Unfortunately I will continue my Pyanodons game in 1.1 without this bugfix. Just out of curiosity: What's the technical solution that can fix this bug and handle all the edge cases that might still occur?
It was mostly a matter of sitting down and figuring out the exact scenario it broke. Once that was found, I just added a check on the inserter side that says essentially "does the target machine allow me to sleep?" and in the case of furnaces with fluid AND item inputs that answer is "no".

Re: [1.1.76] Inserter does not wake up

Posted: Tue Oct 03, 2023 7:00 pm
by SWeini
Rseding91 wrote:
Tue Oct 03, 2023 1:43 pm
SWeini wrote:
Mon Oct 02, 2023 5:48 pm
I don't believe it. You folks are simply the best! Unfortunately I will continue my Pyanodons game in 1.1 without this bugfix. Just out of curiosity: What's the technical solution that can fix this bug and handle all the edge cases that might still occur?
It was mostly a matter of sitting down and figuring out the exact scenario it broke. Once that was found, I just added a check on the inserter side that says essentially "does the target machine allow me to sleep?" and in the case of furnaces with fluid AND item inputs that answer is "no".
I think I get it. So all furnaces with fluid boxes and at least one compatible recipe accepting both item and fluid will use this new behavior, right?

Is there even a small chance to port this back to 1.1? Doesn't sound like a lot of changed code :)