[2.0.57] Module effects on recipes, in furnaces, exposes weird 'bug'

Things that has been reported already before.
Honktown
Smart Inserter
Smart Inserter
Posts: 1058
Joined: Thu Oct 03, 2019 7:10 am
Contact:

[2.0.57] Module effects on recipes, in furnaces, exposes weird 'bug'

Post by Honktown »

Recreation:
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
Mod:
furnace_module_oddity_0.0.1.zip
(870 Bytes) Downloaded 23 times

Place modules in a furnace:
weird_modules-2.jpg
weird_modules-2.jpg (165.16 KiB) Viewed 289 times

Save file:
furnace_effects.zip
(367.87 KiB) Downloaded 23 times

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.
I have mods! I guess!
Link
Honktown
Smart Inserter
Smart Inserter
Posts: 1058
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [2.0.57] Module effects on recipes, in furnaces, exposes weird 'bug'

Post by Honktown »

Also noting: a recipe which isn't active (the machine isn't crafting but shows the recipe) can have the modules inserted. Only when a recipe is active do the modules refuse to insert.
I have mods! I guess!
Link
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4034
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.57] Module effects on recipes, in furnaces, exposes weird 'bug'

Post by boskid »

Duplicate 127208
Post Reply

Return to “Duplicates”