Have a recipe which doesn't accept modules, but the furnace does. A simple example:
Code: Select all
local steel_recipe = data.raw.recipe["steel-plate"]
steel_recipe.allow_productivity = false
Place modules in a furnace:
Save file:
Expectation:
I believe historically (pre-2.0), the machine on the left can have iron plates inserted, but the modules don't work, since they do not apply. They can be removed and inserted at will. Consistent behavior for the right, that one can insert modules, and they do not work.
What happens:
Inserting plates on the left causes the recipe to have modules applied, gaining productivity when the recipe does not allow it.
Inserting modules on the right gives "Productivity module can only be used on intermediate products." and does not insert.
Why this is a bug / relevant to modders:
A modder might not want their modules to apply to any recipe a furnace can use, (based on machine permitted effects and being received by modules).
From a player standpoint, a module can appear to work for a recipe, when a module is inserted before hand. It "suddenly" doesn't work when they go to insert modules after the furnace has switched recipe, and similarly, if they try to upgrade the modules, it won't work.
Code wise, a LuaSurface.find_entities_filtered can search for contains->module-> get the module inventory, find module A+1, remove that module, insert A+2... and it spontaneously fails to insert, even when a module with exactly the same effects may be there, already working. This would also apply for "watched" machines being "upgraded" with special modules.
This is a very surprising behavior, and potentially destroys items, if they are to be upgraded in-place by code.
This has not been tested with beacons, and how a beacons effects may or may magically apply to a recipe dependent on recipe-switching.