diff --git a/mods/mcl_craftguide/init.lua b/mods/mcl_craftguide/init.lua index 48eb164405..9c10c418b1 100644 --- a/mods/mcl_craftguide/init.lua +++ b/mods/mcl_craftguide/init.lua @@ -1,3 +1,5 @@ +mcl_craftguide = {} + local craftguide, datas, mt = {}, {}, minetest local progressive_mode = mt.setting_getbool("craftguide_progressive_mode") local get_recipe, get_recipes = mt.get_craft_recipe, mt.get_all_craft_recipes @@ -426,6 +428,10 @@ function craftguide:on_use(user) end end +mcl_craftguide.show_craftguide = function(player) + craftguide:on_use(player) +end + mt.register_on_player_receive_fields(function(player, formname, fields) if fields.__mcl_craftguide then craftguide:on_use(player) diff --git a/mods/mcl_furnaces/depends.txt b/mods/mcl_furnaces/depends.txt index 315237e07b..fbe5852b9c 100644 --- a/mods/mcl_furnaces/depends.txt +++ b/mods/mcl_furnaces/depends.txt @@ -1 +1,2 @@ mcl_core +mcl_craftguide diff --git a/mods/mcl_furnaces/init.lua b/mods/mcl_furnaces/init.lua index d0824df9f0..5bfffc3b0e 100644 --- a/mods/mcl_furnaces/init.lua +++ b/mods/mcl_furnaces/init.lua @@ -8,6 +8,8 @@ local furnace_inactive_formspec = "list[current_name;fuel;2.75,2.5;1,1;]".. "list[current_name;dst;5.75,1.5;1,1;]".. "image[2.75,1.5;1,1;default_furnace_fire_bg.png]".. + "image_button[8,0;1,1;craftguide_book.png;__mcl_craftguide;]".. + "tooltip[__mcl_craftguide;Show crafting recipes]".. "listring[current_name;dst]".. "listring[current_player;main]".. "listring[current_name;src]".. @@ -15,6 +17,12 @@ local furnace_inactive_formspec = "listring[current_name;fuel]".. "listring[current_player;main]" +local craftguide = function(pos, formname, fields, sender) + if fields.__mcl_craftguide then + mcl_craftguide.show_craftguide(sender) + end +end + minetest.register_node("mcl_furnaces:furnace", { description = "Furnace", tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png", @@ -77,6 +85,7 @@ minetest.register_node("mcl_furnaces:furnace", { return 0 end end, + on_receive_fields = craftguide, }) minetest.register_node("mcl_furnaces:furnace_active", { @@ -142,6 +151,7 @@ minetest.register_node("mcl_furnaces:furnace_active", { return 0 end end, + on_receive_fields = craftguide, }) minetest.register_abm({ @@ -206,6 +216,8 @@ minetest.register_abm({ "list[current_name;dst;5.75,1.5;1,1;]".. "image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:".. (100-percent)..":default_furnace_fire_fg.png]".. + "image_button[8,0;1,1;craftguide_book.png;__mcl_craftguide;]".. + "tooltip[__mcl_craftguide;Show crafting recipes]".. "listring[current_name;dst]".. "listring[current_player;main]".. "listring[current_name;src]"..