2013-03-18 00:09:42 +01:00
|
|
|
-- Various kinds of tables
|
|
|
|
|
2013-10-22 02:31:54 +02:00
|
|
|
local S = homedecor.gettext
|
2013-03-18 00:09:42 +01:00
|
|
|
|
2013-12-15 20:07:36 +01:00
|
|
|
local materials = {
|
2013-04-04 09:55:34 +02:00
|
|
|
{"glass","Glass"},
|
|
|
|
{"wood","Wood"}
|
|
|
|
}
|
2013-03-18 00:09:42 +01:00
|
|
|
|
2014-12-26 03:40:56 +01:00
|
|
|
local tables_cbox = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
|
|
|
}
|
|
|
|
|
2013-04-04 09:55:34 +02:00
|
|
|
for i in ipairs(materials) do
|
|
|
|
local m = materials[i][1]
|
|
|
|
local d = materials[i][2]
|
|
|
|
local s = nil
|
2013-03-18 00:09:42 +01:00
|
|
|
|
2013-04-04 09:55:34 +02:00
|
|
|
if m == "glass" then
|
|
|
|
s = default.node_sound_glass_defaults()
|
|
|
|
else
|
|
|
|
s = default.node_sound_wood_defaults()
|
|
|
|
end
|
2013-03-18 00:09:42 +01:00
|
|
|
|
2013-04-04 09:55:34 +02:00
|
|
|
-- small square tables
|
2013-03-18 00:09:42 +01:00
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register(m.."_table_small_square", {
|
2013-04-04 09:55:34 +02:00
|
|
|
description = S(d.." Table (Small, Square)"),
|
2014-12-14 19:22:44 +01:00
|
|
|
mesh = "homedecor_table_small_square.obj",
|
|
|
|
tiles = { 'homedecor_'..m..'_table_small_square.png' },
|
2014-12-14 22:00:37 +01:00
|
|
|
wield_image = 'homedecor_'..m..'_table_small_square_inv.png',
|
|
|
|
inventory_image = 'homedecor_'..m..'_table_small_square_inv.png',
|
2013-04-04 09:55:34 +02:00
|
|
|
groups = { snappy = 3 },
|
|
|
|
sounds = s,
|
2014-12-26 03:40:56 +01:00
|
|
|
selection_box = tables_cbox,
|
|
|
|
collision_box = tables_cbox,
|
2014-07-20 16:29:12 +02:00
|
|
|
on_place = minetest.rotate_node
|
2013-04-04 09:55:34 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
-- small round tables
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register(m..'_table_small_round', {
|
2013-04-04 09:55:34 +02:00
|
|
|
description = S(d.." Table (Small, Round)"),
|
2014-12-14 02:31:57 +01:00
|
|
|
mesh = "homedecor_table_small_round.obj",
|
|
|
|
tiles = { "homedecor_"..m.."_table_small_round.png" },
|
|
|
|
wield_image = 'homedecor_'..m..'_table_small_round_inv.png',
|
|
|
|
inventory_image = 'homedecor_'..m..'_table_small_round_inv.png',
|
2013-04-04 09:55:34 +02:00
|
|
|
groups = { snappy = 3 },
|
|
|
|
sounds = s,
|
2014-12-26 03:40:56 +01:00
|
|
|
selection_box = tables_cbox,
|
|
|
|
collision_box = tables_cbox,
|
2014-07-20 16:29:12 +02:00
|
|
|
on_place = minetest.rotate_node
|
2013-04-04 09:55:34 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
-- Large square table pieces
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register(m..'_table_large', {
|
2014-03-25 14:16:47 +01:00
|
|
|
description = S(d.." Table Piece (large)"),
|
2015-01-20 23:59:50 +01:00
|
|
|
tiles = {
|
2013-04-04 09:55:34 +02:00
|
|
|
'homedecor_'..m..'_table_large_tb.png',
|
|
|
|
'homedecor_'..m..'_table_large_tb.png',
|
|
|
|
'homedecor_'..m..'_table_large_edges.png',
|
|
|
|
'homedecor_'..m..'_table_large_edges.png',
|
|
|
|
'homedecor_'..m..'_table_large_edges.png',
|
|
|
|
'homedecor_'..m..'_table_large_edges.png'
|
|
|
|
},
|
2014-12-14 22:00:37 +01:00
|
|
|
wield_image = 'homedecor_'..m..'_table_large_inv.png',
|
|
|
|
inventory_image = 'homedecor_'..m..'_table_large_inv.png',
|
2013-04-04 09:55:34 +02:00
|
|
|
groups = { snappy = 3 },
|
|
|
|
sounds = s,
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
|
|
|
},
|
2014-12-26 03:40:56 +01:00
|
|
|
selection_box = tables_cbox,
|
2014-07-20 16:29:12 +02:00
|
|
|
on_place = minetest.rotate_node
|
2013-04-04 09:55:34 +02:00
|
|
|
})
|
|
|
|
|
2014-12-14 18:38:15 +01: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')
|
2013-04-04 09:55:34 +02:00
|
|
|
|
2014-12-14 18:38:15 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
-- conversion routines for old non-6dfacedir tables
|
2013-04-04 09:55:34 +02:00
|
|
|
|
2014-12-14 18:38:15 +01:00
|
|
|
local tlist_s = {}
|
|
|
|
local tlist_t = {}
|
|
|
|
local dirs2 = { 9, 18, 7, 12 }
|
2014-12-14 02:31:57 +01:00
|
|
|
|
2014-12-14 18:38:15 +01:00
|
|
|
for i in ipairs(materials) do
|
|
|
|
local m = materials[i][1]
|
|
|
|
table.insert(tlist_s, "homedecor:"..m.."_table_large_s")
|
|
|
|
table.insert(tlist_s, "homedecor:"..m.."_table_small_square_s")
|
|
|
|
table.insert(tlist_s, "homedecor:"..m.."_table_small_round_s")
|
2013-04-04 09:55:34 +02:00
|
|
|
|
2014-12-14 18:38:15 +01:00
|
|
|
table.insert(tlist_t, "homedecor:"..m.."_table_large_t")
|
|
|
|
table.insert(tlist_t, "homedecor:"..m.."_table_small_square_t")
|
|
|
|
table.insert(tlist_t, "homedecor:"..m.."_table_small_round_t")
|
2013-04-04 09:55:34 +02:00
|
|
|
end
|
|
|
|
|
2014-12-14 18:38:15 +01:00
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = tlist_s,
|
|
|
|
interval = 1,
|
|
|
|
chance = 1,
|
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
|
|
local newnode = string.sub(node.name, 1, -3) -- strip the "_s" from the name
|
|
|
|
local fdir = node.param2 or 0
|
2015-03-05 23:10:27 +01:00
|
|
|
minetest.set_node(pos, {name = newnode, param2 = dirs2[fdir+1]})
|
2014-12-14 18:38:15 +01:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = tlist_t,
|
|
|
|
interval = 1,
|
|
|
|
chance = 1,
|
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
|
|
local newnode = string.sub(node.name, 1, -3) -- strip the "_t" from the name
|
|
|
|
minetest.set_node(pos, { name = newnode, param2 = 20 })
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
-- other tables
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("utility_table_top", {
|
2013-04-04 09:55:34 +02:00
|
|
|
description = S("Utility Table"),
|
|
|
|
tiles = {
|
|
|
|
'homedecor_utility_table_tb.png',
|
|
|
|
'homedecor_utility_table_tb.png',
|
|
|
|
'homedecor_utility_table_edges.png',
|
|
|
|
'homedecor_utility_table_edges.png',
|
|
|
|
'homedecor_utility_table_edges.png',
|
|
|
|
'homedecor_utility_table_edges.png'
|
|
|
|
},
|
|
|
|
wield_image = 'homedecor_utility_table_tb.png',
|
|
|
|
inventory_image = 'homedecor_utility_table_tb.png',
|
2013-03-18 00:09:42 +01:00
|
|
|
groups = { snappy = 3 },
|
2013-04-04 09:55:34 +02:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2013-03-18 00:09:42 +01:00
|
|
|
paramtype2 = "wallmounted",
|
2013-04-04 09:55:34 +02:00
|
|
|
node_box = {
|
|
|
|
type = "wallmounted",
|
|
|
|
wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
|
|
|
wall_top = { -0.5, 0.4375, -0.5, 0.5, 0.5, 0.5 },
|
|
|
|
wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 },
|
|
|
|
},
|
2015-01-23 22:14:00 +01:00
|
|
|
selection_box = {
|
2013-04-04 09:55:34 +02:00
|
|
|
type = "wallmounted",
|
|
|
|
wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
|
|
|
wall_top = { -0.5, 0.4375, -0.5, 0.5, 0.5, 0.5 },
|
|
|
|
wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 },
|
|
|
|
},
|
2013-03-18 00:09:42 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
-- Various kinds of table legs
|
|
|
|
|
2015-02-28 10:14:46 +01:00
|
|
|
local materials = {"brass", "wrought_iron"}
|
2013-03-18 00:09:42 +01:00
|
|
|
|
2015-02-28 10:14:46 +01:00
|
|
|
for _, t in ipairs(materials) do
|
|
|
|
homedecor.register("table_legs_"..t, {
|
|
|
|
description = S("Table Legs ("..t..")"),
|
2015-01-23 22:14:00 +01:00
|
|
|
drawtype = "plantlike",
|
2015-02-28 10:14:46 +01:00
|
|
|
tiles = {"homedecor_table_legs_"..t..".png"},
|
|
|
|
inventory_image = "homedecor_table_legs_"..t..".png",
|
|
|
|
wield_image = "homedecor_table_legs_"..t..".png",
|
2015-01-23 22:14:00 +01:00
|
|
|
walkable = false,
|
|
|
|
groups = {snappy=3},
|
2015-04-29 14:14:36 +02:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2015-01-23 22:14:00 +01:00
|
|
|
selection_box = {
|
2013-04-04 09:55:34 +02:00
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 }
|
|
|
|
},
|
2013-03-18 00:09:42 +01:00
|
|
|
})
|
2015-02-28 10:14:46 +01:00
|
|
|
end
|
2013-03-18 00:09:42 +01:00
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("utility_table_legs", {
|
2013-03-18 00:09:42 +01:00
|
|
|
description = S("Legs for Utility Table"),
|
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = { 'homedecor_utility_table_legs.png' },
|
|
|
|
inventory_image = 'homedecor_utility_table_legs_inv.png',
|
|
|
|
wield_image = 'homedecor_utility_table_legs.png',
|
|
|
|
walkable = false,
|
|
|
|
groups = { snappy = 3 },
|
2013-04-04 09:55:34 +02:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2015-01-23 22:14:00 +01:00
|
|
|
selection_box = {
|
2013-04-04 09:55:34 +02:00
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 }
|
|
|
|
},
|
2013-03-18 00:09:42 +01:00
|
|
|
})
|
|
|
|
|
2015-03-22 03:51:51 +01:00
|
|
|
local desk_cbox = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.5, -0.5, -0.5, 1.5, 0.5, 0.5 }
|
|
|
|
}
|
|
|
|
|
2015-01-23 00:01:08 +01:00
|
|
|
homedecor.register("desk", {
|
2014-06-29 15:06:26 +02:00
|
|
|
description = "Desk",
|
2015-03-22 03:51:51 +01:00
|
|
|
mesh = "homedecor_desk.obj",
|
2014-06-29 15:06:26 +02:00
|
|
|
tiles = {
|
2015-04-28 05:48:02 +02:00
|
|
|
"homedecor_generic_wood_beech.png",
|
2015-03-22 03:51:51 +01:00
|
|
|
"homedecor_desk_drawers.png",
|
2015-04-28 05:48:02 +02:00
|
|
|
"homedecor_generic_metal_black.png",
|
2014-06-29 15:06:26 +02:00
|
|
|
},
|
2014-06-29 18:17:20 +02:00
|
|
|
inventory_image = "homedecor_desk_inv.png",
|
2015-03-22 03:51:51 +01:00
|
|
|
selection_box = desk_cbox,
|
|
|
|
collision_box = desk_cbox,
|
2015-04-29 14:14:36 +02:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2014-06-29 15:06:26 +02:00
|
|
|
groups = { snappy = 3 },
|
2015-03-22 03:51:51 +01:00
|
|
|
expand = { right="air" },
|
2015-03-23 06:44:27 +01:00
|
|
|
inventory = {
|
|
|
|
size=24,
|
|
|
|
},
|
2014-06-29 15:06:26 +02:00
|
|
|
})
|
|
|
|
|
2015-03-22 03:51:51 +01:00
|
|
|
minetest.register_alias("homedecor:desk_r", "air")
|