Quality condenser

by Quezler

A recycler that returns the items themselves but a quality higher, success depends on quality modules.

Content
10 days ago
2.0
2.41K
Factorio: Space Age Icon Space Age Mod
Mining Manufacturing Storage

b Random crash

a month ago

The mod Quality condenser (1.1.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event quality-condenser::on_object_destroyed (ID 170)
quality-condenser/scripts/condense.lua:78: inserted only 33 of 37 assembling-machine-3 (rare)
stack traceback:
[C]: in function 'assert'
quality-condenser/scripts/condense.lua:78: in function 'trigger'
quality-condenser/control.lua:312: in function '?'
quality-condenser/control.lua:361: in function <quality-condenser/control.lua:358>

I'm not really sure what caused it, it just happened randomly.

a month ago

i'll need an autosave that reliably reproduces this crash

a month ago
(updated a month ago)

https://we.tl/t-qIZkMAX20A

this save does have a few different mods in it, shouldn't matter in this case as the root of the problem is as follows:
when machine starts to work the inventory is checked
find all items that can be condensed
determine available slots for overflow between tiers
start the process

in this case the amount of open slots are determined and 86 copper plates epic tier can be condensed where some overflow (16 plates) will go into another slot as overflow

while the machine is condensing new plates are smelted
new plates are put into the machine making the once available slot filled with a different tier that will not allow the overflowing plates to stack

when machine finishes it can't insert all the plates since the slot it had available is no longer open
crash happens because the remaining plates can't be placed anywhere

Idea for possible solutions

First idea (losless):
Add overflow slots which act similar as output only slots like the various crafting machines have
If any items were left over insert them into the overflow slots
When items are in the overflow slots allow them to be picked out by inserters but block the machine from running until the overflow is empty

Second idea (causes loss):
Void any items that would have overflowed allowing the machine to complete

Third idea (could stall the machine forever):
At completion check the items that can be condensed taking available slots into account and perform condensing action at this point rather then calculating the items that can be condensed at the start
This could result in the machine being overloaded with quantities of items that can't be condensed and would permanently stall the machine from being able to condense, could possibly attach a warning event to it and pause the machine from doing anything to let the player deal with it

Fourth idea (not sure if the base game allows this at all):
When the machine runs do not allow new items to be inserted

a month ago
(updated a month ago)

thanks for the report,

i thought i might have fixed it in https://mods.factorio.com/mod/quality-condenser/discussion/67a7d922339eb9750bca33ab but i guess not.

i was reluctant to call sort_and_merge before every insert since that seemed silly and costly, and using a temporary or larger inventory with red blocks was kinda silly too.

the way i fixed it now (which i should have done from the start but only now thought about) is that it sorts and merge if an insert fails, and only if it then fails again will it crash, so please try 1.1.1. :)

a month ago

additionally, you've set both of the machines to legendary, but this is not needed when it is the top quality, and you don't seem to have more quality mods.

New response