Intermediate products are not working

Place to get help with not working mods / modding interface.
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 141
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

Intermediate products are not working

Post by yaim904 »

Context
The idea behind MOD is to create recipes that “compact” and “decompact” items. Compacting is done by a machine, and decompressing is done by the same machine, but also by the player with their hands.
The problem
There is no problem when creating one of the compacted objects.
This can be seen in the examples below, in the number of transport belts that can be manufactured.

It works with only iron plates: Yes
Image

Image

It works with only iron gears: Yes
Image

Image

However, when there are several objects at the same time, intermediate manufacturing is disabled.
This can be seen in the following example.

It works with both active: No
Image

Image
What did you expect to happen?
That compressed iron plates would be treated as iron plates.

In other words,
each compressed iron plate is equivalent to 1,000 normal iron plates, so you should be able to create 500 iron gears or 333 transport bells or any other option.
Functional code to test
I have simplified the idea in the code below to highlight the problem I am having.

Code: Select all

--- --- --- --- --- --- --- --- --- --- --- --- --- ---
---> data.lua
--- --- --- --- --- --- --- --- --- --- --- --- --- ---

local function DeepCopy(value)
    if type(value) ~= "table" then return value end
    local Output = {}
    for Key, Value in pairs(value) do
        Output[Key] = DeepCopy(Value)
    end
    return Output
end

local function getSignal(signal)
    return data.raw["virtual-signal"]["signal-" .. signal .. ""].icon
end

data:extend({
    { type = "recipe-category", name = "zzzYAIM904-do" },
    { type = "recipe-category", name = "zzzYAIM904-undo" }
})

table.insert(data.raw["character"].character.crafting_categories, "zzzYAIM904-undo")
table.insert(data.raw["god-controller"].default.crafting_categories, "zzzYAIM904-undo")

table.insert(data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories, "zzzYAIM904-do")
table.insert(data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories, "zzzYAIM904-undo")

for _, name in pairs({
    "iron-plate",
    "iron-gear-wheel",
}) do
    local item = data.raw.item[name]

    local Item = DeepCopy(item)
    Item.name = "zzzYAIM904-" .. Item.name
    Item.localised_name = { "", "YAIM904 ", { "item-name." .. name } }
    Item.icons = {
        { icon = getSignal("pink") },
        {
            icon = item.icon,
            icon_size = item.icon_size
        }
    }

    local URecipe = {}
    URecipe.type = "recipe"
    URecipe.name = "zzzYAIM904-u-" .. item.name
    URecipe.localised_name = { "", { "item-name." .. name } }
    URecipe.category = "zzzYAIM904-undo"
    URecipe.ingredients = { {
        type = "item",
        name = Item.name,
        amount = 1
    } }
    URecipe.results = { {
        type = "item",
        name = name,
        amount = 1000
    } }
    URecipe.icons = {
        { icon = getSignal("green") },
        {
            icon = item.icon,
            icon_size = item.icon_size
        }
    }

    local DRecipe = {}
    DRecipe.type = "recipe"
    DRecipe.name = "zzzYAIM904-d-" .. item.name
    DRecipe.localised_name = { "", "YAIM904 ", { "item-name." .. name } }
    DRecipe.category = "zzzYAIM904-do"
    DRecipe.results = { {
        type = "item",
        name = Item.name,
        amount = 1
    } }
    DRecipe.ingredients = { {
        type = "item",
        name = name,
        amount = 1000
    } }
    DRecipe.icons = {
        { icon = getSignal("red") },
        {
            icon = item.icon,
            icon_size = item.icon_size
        }
    }

    data:extend({ Item, DRecipe, URecipe })
end

--- --- --- --- --- --- --- --- --- --- --- --- --- ---
If you require more information, please ask.
This is a problem I've had for a long time, and I really want to solve it.
I look forward to any responses.
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 602
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Intermediate products are not working

Post by Silari »

Your images show that you can in fact make iron gears or chests from the compressed iron, even when compressed gears exist, so the recipe can be used as an intermediate regardless.

What happens if you have only 1 compressed iron and 1 compressed gears in your inventory? Can belts be made then?

If you have only two compressed iron in your inventory, can belts be made then?


I suspect it'll work in both those cases.
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 141
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

Re: Intermediate products are not working

Post by yaim904 »

Thank you for your reply
Silari wrote: Sun Nov 23, 2025 5:33 pm What happens if you have only 1 compressed iron and 1 compressed gears in your inventory? Can belts be made then?
(3).png
(3).png (1.04 MiB) Viewed 112 times
Silari wrote: Sun Nov 23, 2025 5:33 pm If you have only two compressed iron in your inventory, can belts be made then?
(4).png
(4).png (1.03 MiB) Viewed 112 times
Conclusion
In the first case, transport belts can be created, but that's because the necessary ingredients are available. No intermediate objects need to be manufactured.

In the second case, I don't see the need for it, but I'll upload the image anyway.
If you have any ideas or questions, I'd be happy to hear them
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 602
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Intermediate products are not working

Post by Silari »

I would've thought the second one would work too, but unfortunately its not what I thought the issue was. I don't see anything in the code that should change how it works just because there's another recipe added.

Maybe someone else will have an idea.
robot256
Smart Inserter
Smart Inserter
Posts: 1312
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Intermediate products are not working

Post by robot256 »

There have been issues in the past with recipes not being usable as handcrafting intermediates. Some were modder mistakes and some were engine bugs, like this one: viewtopic.php?p=540359&hilit=Handcrafti ... te#p540359

Check to see that you have all the flags matching that, and if so, this might be an actual bug.
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 141
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

Re: Intermediate products are not working

Post by yaim904 »

Silari wrote: Sun Nov 23, 2025 10:32 pm
It seems strange to me too, but thank you for trying.
robot256 wrote: Mon Nov 24, 2025 12:18 am
That's happening to me, I'm amazed at how old the post is.

I added the allow_decomposition, allow_intermediates, and allow_as_intermediate properties to the recipes, but it doesn't work. Those properties are set to true by default, but I wanted to try.

It's possible that the error is in the engine, but I haven't heard back from Wube.
The mystery continues
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
Post Reply

Return to “Modding help”