2020-08-05 00:35:08 +02:00
|
|
|
local S = minetest.get_translator("homedecor_seating")
|
2015-04-30 23:52:23 +02:00
|
|
|
local armchair_cbox = {
|
|
|
|
type = "fixed",
|
2016-12-15 22:23:31 +01:00
|
|
|
fixed = {
|
2015-04-30 23:52:23 +02:00
|
|
|
{-0.5, -0.5, -0.5, 0.5, 0, 0.5 },
|
|
|
|
{-0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-27 02:02:29 +02:00
|
|
|
minetest.register_node(":lrfurn:armchair", {
|
2017-01-31 01:37:32 +01:00
|
|
|
description = S("Armchair"),
|
2017-01-30 22:46:04 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "lrfurn_armchair.obj",
|
|
|
|
tiles = {
|
2017-02-16 03:53:52 +01:00
|
|
|
"lrfurn_upholstery.png",
|
2017-01-30 22:46:04 +01:00
|
|
|
{ name = "lrfurn_sofa_bottom.png", color = 0xffffffff }
|
|
|
|
},
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "colorwallmounted",
|
|
|
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
|
|
|
inventory_image = "lrfurn_armchair_inv.png",
|
2022-11-30 23:48:28 +01:00
|
|
|
groups = {snappy=3, ud_param2_colorable = 1, dig_tree=2, axey=5},
|
2024-03-01 00:49:24 +01:00
|
|
|
is_ground_content = false,
|
2022-11-30 23:48:28 +01:00
|
|
|
_mcl_hardness=1.6,
|
2022-05-03 21:21:14 +02:00
|
|
|
_sound_def = {
|
|
|
|
key = "node_sound_wood_defaults",
|
|
|
|
},
|
2017-01-30 22:46:04 +01:00
|
|
|
node_box = armchair_cbox,
|
2017-03-18 10:51:46 +01:00
|
|
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
|
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
|
|
|
end,
|
2019-07-18 08:16:46 +02:00
|
|
|
on_dig = unifieddyes.on_dig,
|
2017-02-18 19:01:49 +01:00
|
|
|
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
|
2017-01-30 22:46:04 +01:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
2022-05-03 21:21:14 +02:00
|
|
|
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
2024-11-07 05:32:14 +01:00
|
|
|
end,
|
|
|
|
on_destruct = lrfurn.on_seat_destruct,
|
2024-12-22 19:59:17 +01:00
|
|
|
on_movenode = lrfurn.on_seat_movenode,
|
2017-01-30 22:46:04 +01:00
|
|
|
})
|
|
|
|
|
2019-05-27 02:02:29 +02:00
|
|
|
homedecor.register("armchair", {
|
|
|
|
description = S("Armchair"),
|
|
|
|
mesh = "forniture_armchair.obj",
|
|
|
|
tiles = {
|
2024-03-03 21:52:58 +01:00
|
|
|
homedecor.textures.wool.white,
|
|
|
|
{ name = homedecor.textures.wool.dark_grey, color = 0xffffffff },
|
|
|
|
{ name = homedecor.textures.wood.apple.planks, color = 0xffffffff }
|
2019-05-27 02:02:29 +02:00
|
|
|
},
|
|
|
|
inventory_image = "homedecor_armchair_inv.png",
|
|
|
|
paramtype2 = "colorwallmounted",
|
|
|
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
2022-05-03 21:21:14 +02:00
|
|
|
groups = {snappy=3, ud_param2_colorable = 1, dig_tree=2},
|
|
|
|
_sound_def = {
|
|
|
|
key = "node_sound_wood_defaults",
|
|
|
|
},
|
2019-08-21 23:44:58 +02:00
|
|
|
node_box = armchair_cbox,
|
2019-05-27 02:02:29 +02:00
|
|
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
|
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
|
|
|
end,
|
2019-07-18 08:16:46 +02:00
|
|
|
on_dig = unifieddyes.on_dig,
|
2019-05-27 02:02:29 +02:00
|
|
|
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
|
2022-05-03 21:21:14 +02:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
|
|
return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
|
2024-11-07 05:32:14 +01:00
|
|
|
end,
|
|
|
|
on_destruct = lrfurn.on_seat_destruct,
|
2024-12-22 19:59:17 +01:00
|
|
|
on_movenode = lrfurn.on_seat_movenode,
|
2019-05-27 02:02:29 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
-- crafts
|
|
|
|
|
2017-01-30 22:46:04 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "lrfurn:armchair",
|
|
|
|
recipe = {
|
|
|
|
{"wool:white", "", "", },
|
2022-05-03 21:21:14 +02:00
|
|
|
{homedecor.materials.slab_wood, "", "", },
|
2017-01-30 22:46:04 +01:00
|
|
|
{"group:stick", "", "", }
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "lrfurn:armchair",
|
|
|
|
recipe = {
|
|
|
|
{"wool:white", "", "", },
|
|
|
|
{"moreblocks:slab_wood", "", "", },
|
|
|
|
{"group:stick", "", "", }
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2018-08-22 11:08:48 +02:00
|
|
|
unifieddyes.register_color_craft({
|
|
|
|
output = "lrfurn:armchair",
|
|
|
|
palette = "wallmounted",
|
|
|
|
type = "shapeless",
|
|
|
|
neutral_node = "lrfurn:armchair",
|
|
|
|
recipe = {
|
|
|
|
"NEUTRAL_NODE",
|
|
|
|
"MAIN_DYE"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2019-05-27 02:02:29 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "homedecor:armchair 2",
|
|
|
|
recipe = {
|
2022-05-03 21:21:14 +02:00
|
|
|
{ homedecor.materials.wool_white,""},
|
2019-05-27 02:02:29 +02:00
|
|
|
{ "group:wood","group:wood" },
|
2022-05-03 21:21:14 +02:00
|
|
|
{ homedecor.materials.wool_white,homedecor.materials.wool_white },
|
2019-05-27 02:02:29 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
unifieddyes.register_color_craft({
|
|
|
|
output = "homedecor:armchair",
|
|
|
|
palette = "wallmounted",
|
|
|
|
type = "shapeless",
|
|
|
|
neutral_node = "homedecor:armchair",
|
|
|
|
recipe = {
|
|
|
|
"NEUTRAL_NODE",
|
|
|
|
"MAIN_DYE"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "homedecor:armchair",
|
|
|
|
burntime = 30,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_alias('armchair', 'homedecor:armchair')
|
|
|
|
|
2017-01-30 22:46:04 +01:00
|
|
|
-- convert old static nodes to param2 color
|
2014-07-19 01:37:08 +02:00
|
|
|
|
2017-01-30 22:46:04 +01:00
|
|
|
lrfurn.old_static_armchairs = {}
|
|
|
|
|
|
|
|
for _, color in ipairs(lrfurn.colors) do
|
|
|
|
table.insert(lrfurn.old_static_armchairs, "lrfurn:armchair_"..color)
|
2014-07-19 01:37:08 +02:00
|
|
|
end
|
|
|
|
|
2017-01-30 22:46:04 +01:00
|
|
|
minetest.register_lbm({
|
2019-05-27 02:02:29 +02:00
|
|
|
name = ":lrfurn:convert_armchairs",
|
2017-01-30 22:46:04 +01:00
|
|
|
label = "Convert lrfurn armchairs to use param2 color",
|
2017-02-16 22:58:48 +01:00
|
|
|
run_at_every_load = false,
|
2017-01-30 22:46:04 +01:00
|
|
|
nodenames = lrfurn.old_static_armchairs,
|
|
|
|
action = function(pos, node)
|
|
|
|
local name = node.name
|
|
|
|
local color = string.sub(name, string.find(name, "_")+1)
|
|
|
|
|
|
|
|
if color == "red" then
|
|
|
|
color = "medium_red"
|
|
|
|
elseif color == "dark_green" then
|
|
|
|
color = "medium_green"
|
|
|
|
elseif color == "magenta" then
|
|
|
|
color = "medium_magenta"
|
|
|
|
elseif color == "cyan" then
|
|
|
|
color = "medium_cyan"
|
|
|
|
end
|
|
|
|
|
|
|
|
local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted")
|
|
|
|
local old_fdir = math.floor(node.param2 % 32)
|
|
|
|
local new_fdir = 3
|
|
|
|
|
|
|
|
if old_fdir == 0 then
|
|
|
|
new_fdir = 3
|
|
|
|
elseif old_fdir == 1 then
|
|
|
|
new_fdir = 4
|
|
|
|
elseif old_fdir == 2 then
|
|
|
|
new_fdir = 2
|
|
|
|
elseif old_fdir == 3 then
|
|
|
|
new_fdir = 5
|
|
|
|
end
|
|
|
|
|
|
|
|
local param2 = paletteidx + new_fdir
|
|
|
|
|
|
|
|
minetest.set_node(pos, { name = "lrfurn:armchair", param2 = param2 })
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("dye", "unifieddyes:"..color)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
2017-05-13 09:15:26 +02:00
|
|
|
if minetest.settings:get("log_mods") then
|
2020-08-05 00:35:08 +02:00
|
|
|
minetest.log("action", "[lrfurn/armchairs] Loaded!")
|
2014-07-19 01:37:08 +02:00
|
|
|
end
|