2019-05-27 02:02:29 +02:00
|
|
|
-- formerly homedecor's misc tables component
|
|
|
|
|
2020-08-05 00:42:05 +02:00
|
|
|
local S = minetest.get_translator("homedecor_tables")
|
2019-05-27 02:02:29 +02:00
|
|
|
|
2021-03-27 04:08:06 +01:00
|
|
|
-- Various kinds of table legs
|
|
|
|
|
|
|
|
local table_shapes = {"large_square", "small_square", "small_round"}
|
|
|
|
|
|
|
|
local tabletop_materials = {
|
2019-05-27 02:02:29 +02:00
|
|
|
{ "glass",
|
2021-03-27 04:08:06 +01:00
|
|
|
S("Small square glass tabletop"),
|
|
|
|
S("Small round glass tabletop"),
|
|
|
|
S("Large glass tabletop piece"),
|
2019-05-27 02:02:29 +02:00
|
|
|
},
|
|
|
|
{ "wood",
|
2021-03-27 04:08:06 +01:00
|
|
|
S("Small square wooden tabletop"),
|
|
|
|
S("Small round wooden tabletop"),
|
|
|
|
S("Large wooden tabletop piece"),
|
2019-05-27 02:02:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-03 21:21:14 +02:00
|
|
|
local leg_materials = {
|
2021-03-27 04:08:06 +01:00
|
|
|
{ "brass", S("brass") },
|
|
|
|
{ "wrought_iron", S("wrought iron") },
|
|
|
|
{ "wood", S("wood") }
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, t in ipairs(leg_materials) do
|
|
|
|
local name, desc = unpack(t)
|
|
|
|
homedecor.register("table_legs_"..name, {
|
|
|
|
description = S("Table Legs (@1)", desc),
|
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"homedecor_table_legs_"..name..".png"},
|
|
|
|
inventory_image = "homedecor_table_legs_"..name..".png",
|
|
|
|
wield_image = "homedecor_table_legs_"..name..".png",
|
|
|
|
walkable = false,
|
2022-02-07 14:18:17 +01:00
|
|
|
use_texture_alpha = "blend",
|
2022-05-03 21:21:14 +02:00
|
|
|
groups = {snappy=3, dig_tree=2},
|
|
|
|
_sound_def = {
|
|
|
|
key = "node_sound_wood_defaults",
|
|
|
|
},
|
2021-03-27 04:08:06 +01:00
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 }
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_alias("homedecor:utility_table_legs", "homedecor:table_legs_wood")
|
|
|
|
minetest.register_alias("homedecor:utility_table_top", "homedecor:wood_table_small_square")
|
|
|
|
|
|
|
|
-- table tops and combined tables
|
|
|
|
|
2019-05-27 02:02:29 +02:00
|
|
|
local tables_cbox = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
|
|
|
}
|
|
|
|
|
2021-03-27 04:08:06 +01:00
|
|
|
for i, mat in ipairs(tabletop_materials) do
|
2022-05-03 21:21:14 +02:00
|
|
|
local m = unpack(mat)
|
2019-05-27 02:02:29 +02:00
|
|
|
local s
|
|
|
|
|
|
|
|
if m == "glass" then
|
2022-05-03 21:21:14 +02:00
|
|
|
s = "node_sound_glass_defaults"
|
2019-05-27 02:02:29 +02:00
|
|
|
else
|
2022-05-03 21:21:14 +02:00
|
|
|
s = "node_sound_wood_defaults"
|
2019-05-27 02:02:29 +02:00
|
|
|
end
|
|
|
|
|
2021-03-27 04:08:06 +01:00
|
|
|
for _, shape in ipairs(table_shapes) do
|
|
|
|
|
|
|
|
homedecor.register(m.."_table_"..shape, {
|
|
|
|
description = shape.." "..m.." tabletop",
|
|
|
|
mesh = "homedecor_table_"..shape..".obj",
|
|
|
|
tiles = {
|
|
|
|
'homedecor_'..m..'_table_'..shape..'.png',
|
|
|
|
'homedecor_'..m..'_table_edges.png',
|
|
|
|
'homedecor_blanktile.png',
|
|
|
|
'homedecor_blanktile.png',
|
|
|
|
'homedecor_blanktile.png',
|
|
|
|
},
|
|
|
|
wield_image = 'homedecor_'..m..'_table_'..shape..'_inv.png',
|
2022-02-07 14:18:17 +01:00
|
|
|
use_texture_alpha = "blend",
|
2022-05-03 21:21:14 +02:00
|
|
|
groups = { snappy = 3, dig_tree=2 },
|
|
|
|
_sound_def = {
|
|
|
|
key = s,
|
|
|
|
},
|
2021-03-27 04:08:06 +01:00
|
|
|
selection_box = tables_cbox,
|
|
|
|
collision_box = tables_cbox,
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
local player_name = placer:get_player_name()
|
|
|
|
if minetest.is_protected(pointed_thing.under, player_name) then return end
|
|
|
|
local node = minetest.get_node(pointed_thing.under)
|
|
|
|
if string.find(node.name, "homedecor:table_legs") then
|
|
|
|
local newname = string.format("homedecor:%s_table_%s_with_%s_legs",
|
|
|
|
m, shape, string.sub(node.name, 22))
|
|
|
|
minetest.set_node(pointed_thing.under, {name = newname})
|
|
|
|
if not creative.is_enabled_for(player_name) then
|
|
|
|
itemstack:take_item()
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
else
|
|
|
|
return minetest.rotate_node(itemstack, placer, pointed_thing)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
for _, l in ipairs(leg_materials) do
|
2022-05-03 21:21:14 +02:00
|
|
|
local leg_mat = unpack(l)
|
2021-03-27 04:08:06 +01:00
|
|
|
|
|
|
|
homedecor.register(string.format("%s_table_%s_with_%s_legs", m, shape, leg_mat), {
|
|
|
|
description = string.format("%s %s table with %s legs", shape, m, leg_mat),
|
|
|
|
mesh = "homedecor_table_"..shape..".obj",
|
|
|
|
tiles = {
|
|
|
|
'homedecor_blanktile.png',
|
|
|
|
'homedecor_blanktile.png',
|
|
|
|
'homedecor_'..m..'_table_'..shape..'.png',
|
|
|
|
'homedecor_'..m..'_table_edges.png',
|
|
|
|
"homedecor_table_legs_"..leg_mat..".png",
|
|
|
|
},
|
2022-02-07 14:18:17 +01:00
|
|
|
use_texture_alpha = "blend",
|
2022-05-03 21:21:14 +02:00
|
|
|
groups = { snappy = 3, dig_tree=2 },
|
|
|
|
_sound_def = {
|
|
|
|
key = s
|
|
|
|
},
|
2021-03-27 04:08:06 +01:00
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
2019-05-27 02:02:29 +02:00
|
|
|
|
|
|
|
minetest.register_alias('homedecor:'..m..'_table_large_b', 'homedecor:'..m..'_table_large')
|
|
|
|
minetest.register_alias('homedecor:'..m..'_table_small_square_b', 'homedecor:'..m..'_table_small_square')
|
|
|
|
minetest.register_alias('homedecor:'..m..'_table_small_round_b', 'homedecor:'..m..'_table_small_round')
|
2021-03-27 04:08:06 +01:00
|
|
|
minetest.register_alias('homedecor:'..m..'_table_large', 'homedecor:'..m..'_table_large_square')
|
2019-05-27 02:02:29 +02:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2021-03-27 04:17:21 +01:00
|
|
|
-- old-style tables that used to be from 3dforniture.
|
|
|
|
|
|
|
|
local table_colors = {
|
|
|
|
{ "", S("Table"), homedecor.plain_wood },
|
|
|
|
{ "_mahogany", S("Mahogany Table"), homedecor.mahogany_wood },
|
|
|
|
{ "_white", S("White Table"), homedecor.white_wood }
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, t in ipairs(table_colors) do
|
|
|
|
local suffix, desc, texture = unpack(t)
|
|
|
|
|
|
|
|
homedecor.register("table"..suffix, {
|
|
|
|
description = desc,
|
|
|
|
tiles = { texture },
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{ -0.4, -0.5, -0.4, -0.3, 0.4, -0.3 },
|
|
|
|
{ 0.3, -0.5, -0.4, 0.4, 0.4, -0.3 },
|
|
|
|
{ -0.4, -0.5, 0.3, -0.3, 0.4, 0.4 },
|
|
|
|
{ 0.3, -0.5, 0.3, 0.4, 0.4, 0.4 },
|
|
|
|
{ -0.5, 0.4, -0.5, 0.5, 0.5, 0.5 },
|
|
|
|
{ -0.4, -0.2, -0.3, -0.3, -0.1, 0.3 },
|
|
|
|
{ 0.3, -0.2, -0.4, 0.4, -0.1, 0.3 },
|
|
|
|
{ -0.3, -0.2, -0.4, 0.4, -0.1, -0.3 },
|
|
|
|
{ -0.3, -0.2, 0.3, 0.3, -0.1, 0.4 },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
2022-05-03 21:21:14 +02:00
|
|
|
_sound_def = {
|
|
|
|
key = "node_sound_wood_defaults",
|
|
|
|
},
|
2021-03-27 04:17:21 +01:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2019-05-27 02:02:29 +02:00
|
|
|
-- crafting
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "homedecor:glass_table_small_round_b 15",
|
|
|
|
recipe = {
|
2022-05-03 21:21:14 +02:00
|
|
|
{ "", homedecor.materials.glass_block, "" },
|
|
|
|
{ homedecor.materials.glass_block, homedecor.materials.glass_block, homedecor.materials.glass_block },
|
|
|
|
{ "", homedecor.materials.glass_block, "" },
|
2019-05-27 02:02:29 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "homedecor:glass_table_small_square_b 2",
|
|
|
|
recipe = {
|
|
|
|
{"homedecor:glass_table_small_round", "homedecor:glass_table_small_round" },
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "homedecor:glass_table_large_b 2",
|
|
|
|
recipe = {
|
|
|
|
{ "homedecor:glass_table_small_square", "homedecor:glass_table_small_square" },
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "homedecor:wood_table_small_round_b 15",
|
|
|
|
recipe = {
|
|
|
|
{ "", "group:wood", "" },
|
|
|
|
{ "group:wood", "group:wood", "group:wood" },
|
|
|
|
{ "", "group:wood", "" },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "homedecor:wood_table_small_square_b 2",
|
|
|
|
recipe = {
|
|
|
|
{ "homedecor:wood_table_small_round","homedecor:wood_table_small_round" },
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "homedecor:wood_table_large_b 2",
|
|
|
|
recipe = {
|
|
|
|
{ "homedecor:wood_table_small_square", "homedecor:wood_table_small_square" },
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "homedecor:wood_table_small_round_b",
|
|
|
|
burntime = 30,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "homedecor:wood_table_small_square_b",
|
|
|
|
burntime = 30,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "homedecor:wood_table_large_b",
|
|
|
|
burntime = 30,
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "homedecor:table_legs_wrought_iron 3",
|
|
|
|
recipe = {
|
2022-05-03 21:21:14 +02:00
|
|
|
{ "", homedecor.materials.iron_lump, "" },
|
|
|
|
{ "", homedecor.materials.iron_lump, "" },
|
|
|
|
{ homedecor.materials.iron_lump, homedecor.materials.iron_lump, homedecor.materials.iron_lump },
|
2019-05-27 02:02:29 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "homedecor:table_legs_brass 3",
|
|
|
|
recipe = {
|
|
|
|
{ "", "basic_materials:brass_ingot", "" },
|
|
|
|
{ "", "basic_materials:brass_ingot", "" },
|
|
|
|
{ "basic_materials:brass_ingot", "basic_materials:brass_ingot", "basic_materials:brass_ingot" }
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "homedecor:utility_table_legs",
|
|
|
|
recipe = {
|
|
|
|
{ "group:stick", "group:stick", "group:stick" },
|
|
|
|
{ "group:stick", "", "group:stick" },
|
|
|
|
{ "group:stick", "", "group:stick" },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "homedecor:utility_table_legs",
|
|
|
|
burntime = 30,
|
|
|
|
})
|
|
|
|
|
2021-03-27 04:08:06 +01:00
|
|
|
for _, shape in ipairs (table_shapes) do
|
|
|
|
for _, leg in ipairs(leg_materials) do
|
|
|
|
for _, mat in ipairs(tabletop_materials) do
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "homedecor:"..mat[1].."_table_"..shape.."_with_"..leg[1].."_legs",
|
|
|
|
type = "shapeless",
|
|
|
|
recipe = {
|
|
|
|
"homedecor:"..mat[1].."_table_"..shape,
|
|
|
|
"homedecor:table_legs_"..leg[1]
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-05-27 02:02:29 +02:00
|
|
|
|
2021-03-27 04:17:21 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "homedecor:table",
|
|
|
|
recipe = {
|
|
|
|
{ "group:wood","group:wood", "group:wood" },
|
|
|
|
{ "group:stick", "", "group:stick" },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "homedecor:table_mahogany",
|
|
|
|
recipe = {
|
|
|
|
"homedecor:table",
|
2022-05-03 21:21:14 +02:00
|
|
|
homedecor.materials.dye_brown,
|
2021-03-27 04:17:21 +01:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "homedecor:table_mahogany",
|
|
|
|
recipe = {
|
|
|
|
"homedecor:table",
|
|
|
|
"unifieddyes:dark_orange",
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "homedecor:table_white",
|
|
|
|
recipe = {
|
|
|
|
"homedecor:table",
|
2022-05-03 21:21:14 +02:00
|
|
|
homedecor.materials.dye_white,
|
2021-03-27 04:17:21 +01:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "homedecor:table",
|
|
|
|
burntime = 30,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "homedecor:table_mahogany",
|
|
|
|
burntime = 30,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "homedecor:table_white",
|
|
|
|
burntime = 30,
|
|
|
|
})
|
|
|
|
|
2019-05-27 02:02:29 +02:00
|
|
|
-- recycling
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "vessels:glass_fragments",
|
|
|
|
recipe = {
|
|
|
|
"homedecor:glass_table_small_round",
|
|
|
|
"homedecor:glass_table_small_round",
|
|
|
|
"homedecor:glass_table_small_round"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "vessels:glass_fragments",
|
|
|
|
recipe = {
|
|
|
|
"homedecor:glass_table_small_square",
|
|
|
|
"homedecor:glass_table_small_square",
|
|
|
|
"homedecor:glass_table_small_square"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "vessels:glass_fragments",
|
|
|
|
recipe = {
|
|
|
|
"homedecor:glass_table_large",
|
|
|
|
"homedecor:glass_table_large",
|
|
|
|
"homedecor:glass_table_large"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "default:stick 4",
|
|
|
|
recipe = {
|
|
|
|
"homedecor:wood_table_small_round",
|
|
|
|
"homedecor:wood_table_small_round",
|
|
|
|
"homedecor:wood_table_small_round"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "default:stick 4",
|
|
|
|
recipe = {
|
|
|
|
"homedecor:wood_table_small_square",
|
|
|
|
"homedecor:wood_table_small_square",
|
|
|
|
"homedecor:wood_table_small_square"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "default:stick 4",
|
|
|
|
recipe = {
|
|
|
|
"homedecor:wood_table_large",
|
|
|
|
"homedecor:wood_table_large",
|
|
|
|
"homedecor:wood_table_large"
|
|
|
|
}
|
|
|
|
})
|
2021-03-27 04:29:07 +01:00
|
|
|
|
|
|
|
-- Aliases for the above 3dforniture-like tables
|
|
|
|
|
|
|
|
minetest.register_alias("3dforniture:table", "homedecor:table")
|
|
|
|
minetest.register_alias('table', 'homedecor:table')
|