forked from VoxeLibre/VoxeLibre
Add crafting guide button on furnace
This commit is contained in:
parent
e7f49a54f2
commit
899e8f6d30
|
@ -1,3 +1,5 @@
|
||||||
|
mcl_craftguide = {}
|
||||||
|
|
||||||
local craftguide, datas, mt = {}, {}, minetest
|
local craftguide, datas, mt = {}, {}, minetest
|
||||||
local progressive_mode = mt.setting_getbool("craftguide_progressive_mode")
|
local progressive_mode = mt.setting_getbool("craftguide_progressive_mode")
|
||||||
local get_recipe, get_recipes = mt.get_craft_recipe, mt.get_all_craft_recipes
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mcl_craftguide.show_craftguide = function(player)
|
||||||
|
craftguide:on_use(player)
|
||||||
|
end
|
||||||
|
|
||||||
mt.register_on_player_receive_fields(function(player, formname, fields)
|
mt.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if fields.__mcl_craftguide then
|
if fields.__mcl_craftguide then
|
||||||
craftguide:on_use(player)
|
craftguide:on_use(player)
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
mcl_core
|
mcl_core
|
||||||
|
mcl_craftguide
|
||||||
|
|
|
@ -8,6 +8,8 @@ local furnace_inactive_formspec =
|
||||||
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||||
"list[current_name;dst;5.75,1.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[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_name;dst]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
"listring[current_name;src]"..
|
"listring[current_name;src]"..
|
||||||
|
@ -15,6 +17,12 @@ local furnace_inactive_formspec =
|
||||||
"listring[current_name;fuel]"..
|
"listring[current_name;fuel]"..
|
||||||
"listring[current_player;main]"
|
"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", {
|
minetest.register_node("mcl_furnaces:furnace", {
|
||||||
description = "Furnace",
|
description = "Furnace",
|
||||||
tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
|
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
|
return 0
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
on_receive_fields = craftguide,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("mcl_furnaces:furnace_active", {
|
minetest.register_node("mcl_furnaces:furnace_active", {
|
||||||
|
@ -142,6 +151,7 @@ minetest.register_node("mcl_furnaces:furnace_active", {
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
on_receive_fields = craftguide,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
|
@ -206,6 +216,8 @@ minetest.register_abm({
|
||||||
"list[current_name;dst;5.75,1.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^[lowpart:"..
|
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||||
(100-percent)..":default_furnace_fire_fg.png]"..
|
(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_name;dst]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
"listring[current_name;src]"..
|
"listring[current_name;src]"..
|
||||||
|
|
Loading…
Reference in New Issue