2021-05-29 14:12:33 +00:00
|
|
|
|
local S = minetest.get_translator(minetest.get_current_modname())
|
2021-03-13 10:12:26 +00:00
|
|
|
|
local formspec_escape = minetest.formspec_escape
|
|
|
|
|
local show_formspec = minetest.show_formspec
|
|
|
|
|
local C = minetest.colorize
|
2021-04-19 12:44:20 +00:00
|
|
|
|
local text_color = "#313131"
|
2021-03-13 10:12:26 +00:00
|
|
|
|
local itemslot_bg = mcl_formspec.get_itemslot_bg
|
2019-03-07 23:00:09 +00:00
|
|
|
|
|
2021-03-13 10:12:26 +00:00
|
|
|
|
mcl_crafting_table = {}
|
2021-07-08 13:03:06 +00:00
|
|
|
|
|
2021-03-13 10:12:26 +00:00
|
|
|
|
function mcl_crafting_table.show_crafting_form(player)
|
|
|
|
|
player:get_inventory():set_width("craft", 3)
|
|
|
|
|
player:get_inventory():set_size("craft", 9)
|
|
|
|
|
|
|
|
|
|
show_formspec(player:get_player_name(), "main",
|
|
|
|
|
"size[9,8.75]"..
|
|
|
|
|
"image[4.7,1.5;1.5,1;gui_crafting_arrow.png]"..
|
2021-03-29 22:01:29 +00:00
|
|
|
|
"label[0,4;"..formspec_escape(C(text_color, S("Inventory"))).."]"..
|
2021-03-13 10:12:26 +00:00
|
|
|
|
"list[current_player;main;0,4.5;9,3;9]"..
|
|
|
|
|
itemslot_bg(0,4.5,9,3)..
|
|
|
|
|
"list[current_player;main;0,7.74;9,1;]"..
|
|
|
|
|
itemslot_bg(0,7.74,9,1)..
|
|
|
|
|
"label[1.75,0;"..formspec_escape(C(text_color, S("Crafting"))).."]"..
|
|
|
|
|
"list[current_player;craft;1.75,0.5;3,3;]"..
|
|
|
|
|
itemslot_bg(1.75,0.5,3,3)..
|
|
|
|
|
"list[current_player;craftpreview;6.1,1.5;1,1;]"..
|
|
|
|
|
itemslot_bg(6.1,1.5,1,1)..
|
|
|
|
|
"image_button[0.75,1.5;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
|
|
|
|
"tooltip[__mcl_craftguide;"..formspec_escape(S("Recipe book")).."]"..
|
|
|
|
|
"listring[current_player;main]"..
|
|
|
|
|
"listring[current_player;craft]"
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
|
2017-06-03 00:09:56 +00:00
|
|
|
|
minetest.register_node("mcl_crafting_table:crafting_table", {
|
2019-03-07 23:00:09 +00:00
|
|
|
|
description = S("Crafting Table"),
|
2020-03-12 00:35:11 +00:00
|
|
|
|
_tt_help = S("3×3 crafting grid"),
|
2019-03-07 23:00:09 +00:00
|
|
|
|
_doc_items_longdesc = S("A crafting table is a block which grants you access to a 3×3 crafting grid which allows you to perform advanced crafts."),
|
|
|
|
|
_doc_items_usagehelp = S("Rightclick the crafting table to access the 3×3 crafting grid."),
|
2017-06-03 00:09:56 +00:00
|
|
|
|
_doc_items_hidden = false,
|
|
|
|
|
is_ground_content = false,
|
|
|
|
|
tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png",
|
|
|
|
|
"crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"},
|
|
|
|
|
paramtype2 = "facedir",
|
2020-04-18 21:24:42 +00:00
|
|
|
|
groups = {handy=1,axey=1, deco_block=1, material_wood=1,flammable=-1},
|
2017-06-03 00:09:56 +00:00
|
|
|
|
on_rightclick = function(pos, node, player, itemstack)
|
2021-07-08 13:03:06 +00:00
|
|
|
|
if not player:get_player_control().sneak then
|
|
|
|
|
mcl_crafting_table.show_crafting_form(player)
|
|
|
|
|
end
|
2017-06-03 00:09:56 +00:00
|
|
|
|
end,
|
|
|
|
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
2020-04-17 19:40:13 +00:00
|
|
|
|
_mcl_blast_resistance = 2.5,
|
2017-06-03 00:09:56 +00:00
|
|
|
|
_mcl_hardness = 2.5,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
|
output = "mcl_crafting_table:crafting_table",
|
|
|
|
|
recipe = {
|
|
|
|
|
{"group:wood", "group:wood"},
|
|
|
|
|
{"group:wood", "group:wood"}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
|
type = "fuel",
|
|
|
|
|
recipe = "mcl_crafting_table:crafting_table",
|
|
|
|
|
burntime = 15,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
minetest.register_alias("crafting:workbench", "mcl_crafting_table:crafting_table")
|
|
|
|
|
minetest.register_alias("mcl_inventory:workbench", "mcl_crafting_table:crafting_table")
|