minetest-mods / craftguide

:book: The most comprehensive Crafting Guide on Minetest
Other
43 stars 20 forks source link

mesecons_materials + basic_materials - Silicon lump recipe not shown #91

Closed bell07 closed 4 years ago

bell07 commented 4 years ago

As reported in https://forum.minetest.net/viewtopic.php?f=15&p=358409#p358409, the recipe for Silicon lump is not shown in craftguide, but is crafteable. I looked into the code and it seems to be an issue with minetest.register_alias_force()

Homedecor basic_materials:

minetest.register_craftitem("basic_materials:silicon", {
        description = "Silicon lump",
        inventory_image = "basic_materials_silicon.png",
})

minetest.register_craft( {
        output = "mesecons_materials:silicon 4",
        recipe = {
                { "default:sand", "default:sand" },
                { "default:sand", "default:steel_ingot" },
        },
})

minetest.register_alias_force("mesecons_materials:silicon", "basic_materials:silicon")

Mesecons mesecons_materials:

minetest.register_craftitem("mesecons_materials:silicon", {
        image = "mesecons_silicon.png",
        on_place_on_ground = minetest.craftitem_place_item,
        description="Silicon",
})

Looks wrong defined in homedecor, but should be still be shown in craftguide

kilbith commented 4 years ago

Fixed by https://github.com/minetest-mods/craftguide/commit/bb6b3a4ee58cfc1383847e7d74e460e0dfd3ef93

bell07 commented 4 years ago

The discussion was moved to https://github.com/minetest-mods/craftguide/issues/92, but basically this one is still open. Can you pls. reopen this #91?

The expected behaviour is the "basic_materials:silicon" and "mesecons_materials:silicon" are shown merged in craftguide because of minetest.register_alias_force(). Currently they are 2x items in craftguide, one with recipe how to craft and the other with item usages.

kilbith commented 4 years ago

https://github.com/minetest-mods/craftguide/commit/b09870a5b295f1b87036c0bdb85769600688feb1

bell07 commented 4 years ago

Still does not work. The 3x Sand + 1x Iron Lump is again not in the list

bell07 commented 4 years ago

The silicon lump needs to be in usages of sand...

kilbith commented 4 years ago

https://github.com/minetest-mods/craftguide/commit/937f5f0918fc4c0f3c74274b076828535ceedfa6

bell07 commented 4 years ago

Found solution that works for me. The issue is in handle_aliases at: local recipes = recipes_cache[oldname]

In my setup the core.get_all_craft_recipes('basic_materials:silicon') returned empty table (registered_item), but core.get_all_craft_recipes('mesecons_materials:silicon') returns the recipe (oldname).

Added recipes_cache[oldname] = recipes_cache[oldname] or get_all_recipes(oldname) before the line, and the recipe is visible now ;-)

kilbith commented 4 years ago

Thanks.

https://github.com/minetest-mods/craftguide/commit/edbed14d9bb3a1890a89bc689a68de9a90782b08

bell07 commented 4 years ago

It does not work again after last changes :-( And I do not see the reason... Please re-test it with both mods (mesecons_materials + basic_materials) enabled.

kilbith commented 4 years ago

Nothing has changed in this part. Please conduct your investigation yourself and provide a patch.