[1.1.1] Changing input inventory and recipe of assembly machine in same tick doesn't update properly
Posted: Thu Nov 26, 2020 6:14 pm
I've noticed what appears to be a regression because as far as I'm aware it was working fine before the latest version.
Basically it seems like changing the input inventory of the machine, then changing the recipe in the same tick, doesn't update properly.
I've worked around this issue by just using inventory.get_contents() before changing the recipe, but that workaround only works because I'm always setting the recipe to "nil". It wouldn't work if I were to set the recipe to something else that uses iron plates.
Code: Select all
local machine = some_assembling_machine
local inventory = machine.get_inventory(defines.inventory.assembling_machine_input)
-- for this example the recipe takes 1 iron plate, and the machine contains 2 iron plates
inventory.remove{name="iron-plate",count=1}
local spill = machine.set_recipe(nil)
-- spill is expected to be the remaining 1 iron plate, but it is 2 iron plates instead
I've worked around this issue by just using inventory.get_contents() before changing the recipe, but that workaround only works because I'm always setting the recipe to "nil". It wouldn't work if I were to set the recipe to something else that uses iron plates.