Reorganize files

This commit is contained in:
jp 2015-02-25 10:35:29 +01:00
parent d009cdd649
commit d3199606ec
5 changed files with 752 additions and 749 deletions

151
homedecor/books.lua Normal file
View File

@ -0,0 +1,151 @@
local S = homedecor.gettext
local bookcolors = {
"red",
"green",
"blue",
"violet",
"grey",
"brown"
}
local BOOK_FORMNAME = "homedecor:book_form"
for c in ipairs(bookcolors) do
local color = bookcolors[c]
local color_d = S(bookcolors[c])
local function book_dig(pos, node, digger)
if minetest.is_protected(pos, digger:get_player_name()) then return end
local meta = minetest.get_meta(pos)
local stack = ItemStack({
name = "homedecor:book_"..color,
metadata = meta:get_string("text"),
})
stack = digger:get_inventory():add_item("main", stack)
if not stack:is_empty() then
minetest.item_drop(stack, digger, pos)
end
minetest.remove_node(pos)
end
homedecor.register("book_"..color, {
description = S("Book (%s)"):format(color_d),
mesh = "homedecor_book.obj",
tiles = { "homedecor_book_"..color..".png" },
inventory_image = "homedecor_book_"..color.."_inv.png",
wield_image = "homedecor_book_"..color.."_inv.png",
groups = { snappy=3, oddly_breakable_by_hand=3, book=1 },
stack_max = 1,
on_rightclick = function(pos, node, clicker)
local fdir = node.param2
minetest.swap_node(pos, { name = "homedecor:book_open_"..color, param2 = fdir })
end,
on_place = function(itemstack, placer, pointed_thing)
local plname = placer:get_player_name()
local pos = pointed_thing.under
local node = minetest.get_node(pos)
local n = minetest.registered_nodes[node.name]
if not n.buildable_to then
pos = pointed_thing.above
node = minetest.get_node(pos)
n = minetest.registered_nodes[node.name]
if not n.buildable_to then return end
end
if minetest.is_protected(pos, plname) then return end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.set_node(pos, {
name = "homedecor:book_"..color,
param2 = fdir,
})
local text = itemstack:get_metadata() or ""
local meta = minetest.get_meta(pos)
meta:set_string("text", text)
local data = minetest.deserialize(text) or {}
if data.title and data.title ~= "" then
meta:set_string("infotext", data.title)
end
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
on_dig = book_dig,
on_use = function(itemstack, user, pointed_thing)
local player_name = user:get_player_name()
local data = minetest.deserialize(itemstack:get_metadata())
local title, text, owner = "", "", player_name
if data then
title, text, owner = data.title, data.text, data.owner
end
local formspec
if owner == player_name then
formspec = "size[8,8]"..default.gui_bg..default.gui_bg_img..
"field[0.5,1;7.5,0;title;Book title :;"..
minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;text;Book content :;"..
minetest.formspec_escape(text).."]"..
"button_exit[2.5,7.5;3,1;save;Save]"
else
formspec = "size[8,8]"..default.gui_bg..
"button_exit[7,0.25;1,0.5;close;X]"..
default.gui_bg_img..
"label[0.5,0.5;by "..owner.."]"..
"label[0.5,0;"..minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]"
end
minetest.show_formspec(user:get_player_name(), BOOK_FORMNAME, formspec)
end,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.25, 0.2, -0.35, 0.25}
},
collision_box = {
type = "fixed",
fixed = {-0.15, -0.5, -0.25, 0.15, -0.35, 0.25}
},
})
homedecor.register("book_open_"..color, {
mesh = "homedecor_book_open.obj",
tiles = { "homedecor_book_open_"..color..".png" },
groups = { snappy=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1 },
drop = "homedecor:book_"..color,
on_dig = book_dig,
on_rightclick = function(pos, node, clicker)
local fdir = node.param2
minetest.swap_node(pos, { name = "homedecor:book_"..color, param2 = fdir })
minetest.sound_play("homedecor_book_close", {
pos=pos,
max_hear_distance = 3,
gain = 2,
})
end,
selection_box = {
type = "fixed",
fixed = {-0.35, -0.5, -0.25, 0.35, -0.4, 0.25}
},
collision_box = {
type = "fixed",
fixed = {-0.35, -0.5, -0.25, 0.35, -0.4, 0.25}
},
})
end
minetest.register_on_player_receive_fields(function(player, form_name, fields)
if form_name ~= BOOK_FORMNAME or not fields.save then
return
end
local stack = player:get_wielded_item()
if minetest.get_item_group(stack:get_name(), "book") == 0 then
return
end
local data = minetest.deserialize(stack:get_metadata()) or {}
data.title, data.text, data.owner =
fields.title, fields.text, player:get_player_name()
stack:set_metadata(minetest.serialize(data))
player:set_wielded_item(stack)
minetest.log("action", player:get_player_name().." has written in a book (title: \""..fields.title.."\"): \""..fields.text..
"\" at location: "..minetest.pos_to_string(player:getpos()))
end)

560
homedecor/exterior.lua Normal file
View File

@ -0,0 +1,560 @@
local S = homedecor.gettext
dofile(homedecor.modpath.."/furniture.lua")
homedecor.register("barbecue", {
description = "Barbecue",
tiles = {
{name="homedecor_barbecue_top.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=2}},
"forniture_black_metal.png",
},
groups = { snappy=3 },
light_source = 9,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.25, -0.4375, 0.0625, 0.3125}, -- NodeBox1
{0.4375, -0.5, 0.25, 0.5, 0.0625, 0.3125}, -- NodeBox2
{-0.5, -0.5, -0.3125, -0.4375, 0.0625, -0.25}, -- NodeBox3
{0.4375, -0.5, -0.3125, 0.5, 0.0625, -0.25}, -- NodeBox4
{-0.5, 0.0625, -0.3125, 0.5, 0.375, 0.3125}, -- NodeBox5
{-0.375, 0.5, -0.25, -0.313, 0.5, 0.251}, -- NodeBox6
{-0.25, 0.5, -0.25, -0.188, 0.5, 0.251}, -- NodeBox7
{-0.125, 0.5, -0.25, -0.063, 0.5, 0.251}, -- NodeBox8
{0, 0.5, -0.25, 0.062, 0.5, 0.251}, -- NodeBox9
{0.125, 0.5, -0.25, 0.187, 0.5, 0.251}, -- NodeBox10
{0.25, 0.5, -0.25, 0.312, 0.5, 0.251}, -- NodeBox11
{0.375, 0.5, -0.25, 0.437, 0.5, 0.251}, -- NodeBox12
{-0.5, 0.375, 0.251, 0.5, 0.5, 0.3125}, -- NodeBox13
{-0.5, 0.0625, -0.3125, 0.5, 0.5, -0.25}, -- NodeBox14
{-0.5, 0.0625, -0.3125, -0.438, 0.5, 0.3125}, -- NodeBox15
{0.4375, 0.0625, -0.3125, 0.5, 0.5, 0.3125}, -- NodeBox16
}
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.3125, 0.5, 0.625, 0.3125 }
},
expand = { top="homedecor:barbecue_meat" },
})
homedecor.register("barbecue_meat", {
tiles = {
"homedecor_barbecue_meat.png",
},
groups = { snappy=3, not_in_creative_inventory=1 },
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.125, -0.0625, -0.4375, 0.125}, -- NodeBox1
{0.125, -0.5, -0.125, 0.3125, -0.4375, 0.125}, -- NodeBox2
}
},
selection_box = homedecor.nodebox.null
})
homedecor.register("bench_large_1_left", {
description = "Garden Bench (style 1)",
tiles = {
"homedecor_bench_large_1_left_top.png",
"homedecor_bench_large_1_left_bottom.png",
"homedecor_bench_large_1_ends.png^[transformFX",
"homedecor_bench_large_1_ends.png",
"homedecor_bench_large_1_left_back.png",
"homedecor_bench_large_1_left_front.png"
},
inventory_image = "homedecor_bench_large_1_inv.png",
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.25, 0.375, 0.5, 0.4375, 0.4375}, -- NodeBox1
{-0.5, 0, 0.375, 0.5, 0.1875, 0.4375}, -- NodeBox2
{-0.5, -0.125, 0.115, 0.5, -0.0625, 0.35}, -- NodeBox3
{-0.5, -0.125, -0.0872, 0.5, -0.0625, 0.079}, -- NodeBox4
{-0.3125, -0.5, 0.4375, -0.25, 0.375, 0.5}, -- NodeBox5
{-0.3125, -0.25, -0.0625, -0.25, -0.125, 0.4375}, -- NodeBox6
{-0.3125, -0.5, -0.0625, -0.25, -0.25, 0}, -- NodeBox7
}
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.09375, 1.5, 0.5, 0.5 }
},
expand = { right="homedecor:bench_large_1_right" },
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
homedecor.register("bench_large_1_right", {
tiles = {
"homedecor_bench_large_1_left_top.png^[transformFX",
"homedecor_bench_large_1_left_bottom.png^[transformFX",
"homedecor_bench_large_1_ends.png^[transformFX",
"homedecor_bench_large_1_ends.png",
"homedecor_bench_large_1_left_back.png^[transformFX",
"homedecor_bench_large_1_left_front.png^[transformFX"
},
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.25, 0.375, 0.5, 0.4375, 0.4375}, -- NodeBox1
{-0.5, 0, 0.375, 0.5, 0.1875, 0.4375}, -- NodeBox2
{-0.5, -0.125, 0.115, 0.5, -0.0625, 0.35}, -- NodeBox3
{-0.5, -0.125, -0.0872, 0.5, -0.0625, 0.079}, -- NodeBox4
{0.25, -0.5, 0.4375, 0.3125, 0.375, 0.5}, -- NodeBox5
{0.25, -0.25, -0.0625, 0.3125, -0.125, 0.5}, -- NodeBox6
{0.25, -0.5, -0.0625, 0.3125, -0.25, 0}, -- NodeBox7
}
},
selection_box = homedecor.nodebox.null,
})
homedecor.register("bench_large_2_left", {
description = "Garden Bench (style 2)",
tiles = {
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_bench_large_2_left_back.png",
"homedecor_bench_large_2_left_back.png^[transformFX"
},
inventory_image = "homedecor_bench_large_2_inv.png",
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.375, -0.375, 0.5, 0.5}, -- NodeBox1
{-0.375, 0.3125, 0.4375, 0.5, 0.4375, 0.5}, -- NodeBox2
{-0.375, -0.0625, 0.4375, 0.5, 0.0625, 0.5}, -- NodeBox3
{-0.3125, 0.0625, 0.45, -0.25, 0.3125, 0.48}, -- NodeBox4
{-0.1875, 0.0625, 0.45, -0.125, 0.3125, 0.48}, -- NodeBox5
{-0.0625, 0.0625, 0.45, 0, 0.3125, 0.48}, -- NodeBox6
{0.0625, 0.0625, 0.45, 0.125, 0.3125, 0.48}, -- NodeBox7
{0.1875, 0.0625, 0.45, 0.25, 0.3125, 0.48}, -- NodeBox8
{0.3125, 0.0625, 0.45, 0.375, 0.3125, 0.48}, -- NodeBox9
{0.4375, 0.0625, 0.45, 0.5, 0.3125, 0.48}, -- NodeBox10
{-0.5, 0.0625, -0.145362, -0.375, 0.125, 0.375}, -- NodeBox11
{-0.5, -0.5, -0.0625, -0.375, 0.0625, 0.0625}, -- NodeBox12
{-0.4375, -0.125, -0.0625, 0.5, -0.0911603, 0.4375}, -- NodeBox13
{-0.4375, -0.4375, 0.0625, -0.375, -0.3125, 0.375}, -- NodeBox14
{-0.375, -0.342324, 0.25, 0.5, -0.4375, 0.1875}, -- NodeBox15
{-0.5, -0.25, -0.0290173, 0.5, -0.125, 0.0125346}, -- NodeBox16
}
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.15625, 1.5, 0.5, 0.5 }
},
expand = { right="homedecor:bench_large_2_right" },
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
homedecor.register("bench_large_2_right", {
tiles = {
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_bench_large_2_right_back.png",
"homedecor_bench_large_2_right_back.png^[transformFX"
},
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{0.375, -0.5, 0.375, 0.5, 0.5, 0.5}, -- NodeBox1
{-0.5, 0.3125, 0.4375, 0.375, 0.4375, 0.5}, -- NodeBox2
{-0.5, -0.0625, 0.4375, 0.375, 0.0625, 0.5}, -- NodeBox3
{-0.5, 0.0625, 0.45, -0.4375, 0.3125, 0.48}, -- NodeBox4
{-0.375, 0.0625, 0.45, -0.3125, 0.3125, 0.48}, -- NodeBox5
{-0.25, 0.0625, 0.45, -0.1875, 0.3125, 0.48}, -- NodeBox6
{-0.125, 0.0625, 0.45, -0.0625, 0.3125, 0.48}, -- NodeBox7
{0, 0.0625, 0.45, 0.0625, 0.3125, 0.48}, -- NodeBox8
{0.125, 0.0625, 0.45, 0.1875, 0.3125, 0.48}, -- NodeBox9
{0.25, 0.0625, 0.45, 0.3125, 0.3125, 0.48}, -- NodeBox10
{0.375, 0.0625, -0.145362, 0.5, 0.125, 0.375}, -- NodeBox11
{0.375, -0.5, -0.0625, 0.5, 0.125, 0.0625}, -- NodeBox12
{0.375, -0.4375, 0.0625, 0.4375, -0.3125, 0.375}, -- NodeBox13
{-0.5, -0.4375, 0.1875, 0.375, -0.342324, 0.25}, -- NodeBox14
{-0.5, -0.125, -0.0625, 0.4375, -0.0911603, 0.4375}, -- NodeBox15
{-0.5, -0.25, -0.0290173, 0.5, -0.125, 0.0125346}, -- NodeBox16
}
},
selection_box = homedecor.nodebox.null,
})
homedecor.register("deckchair_head", {
tiles = {
"homedecor_deckchair_top_c1.png",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_sides.png^[transformFX",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_front.png"
},
groups = { snappy = 3, not_in_creative_inventory = 1 },
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.3125, -0.0625, 0.375, -0.25, 0}, -- NodeBox1
{-0.375, -0.25, 0, 0.375, -0.1875, 0.0625}, -- NodeBox2
{-0.375, -0.1875, 0.0625, 0.375, -0.125, 0.125}, -- NodeBox3
{-0.375, -0.125, 0.125, 0.375, -0.0625, 0.1875}, -- NodeBox4
{-0.375, -0.0625, 0.1875, 0.375, 0, 0.25}, -- NodeBox5
{-0.375, 0, 0.25, 0.375, 0.0625, 0.3125}, -- NodeBox6
{-0.375, 0.0625, 0.3125, 0.375, 0.125, 0.375}, -- NodeBox7
{-0.375, 0.125, 0.375, 0.375, 0.1875, 0.4375}, -- NodeBox8
{-0.375, 0.1875, 0.4375, 0.375, 0.25, 0.5}, -- NodeBox9
{-0.375, -0.375, -0.5, 0.375, -0.3125, 0.0625}, -- NodeBox10
{0.3125, -0.1875, -0.5, 0.4375, -0.1575, 0.0625}, -- NodeBox11
{-0.4375, -0.1875, -0.5, -0.3125, -0.1575, 0.0625}, -- NodeBox12
{0.3125, -0.5, 0, 0.375, -0.25, 0.0625}, -- NodeBox13
{-0.375, -0.5, 0, -0.3125, -0.25, 0.0625}, -- NodeBox14
}
},
selection_box = homedecor.nodebox.null
})
homedecor.register("deckchair_foot", {
tiles = {
"homedecor_deckchair_top_c2.png",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_sides.png^[transformFX",
"homedecor_deckchair_front.png"
},
description = "Deck chair",
inventory_image = "homedecor_deckchair_inv.png",
groups = { snappy = 3 },
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.375, -0.5, 0.375, -0.3125, 0.5}, -- NodeBox1
{0.3125, -0.5, -0.5, 0.375, -0.375, -0.4375}, -- NodeBox2
{-0.375, -0.5, -0.5, -0.3125, -0.375, -0.4375}, -- NodeBox3
{0.3125, -0.1875, 0.3, 0.4375, -0.1575, 0.5}, -- NodeBox4
{-0.4375, -0.1875, 0.3, -0.3125, -0.1575, 0.5}, -- NodeBox5
{-0.365, -0.3125, 0.32, -0.3225, -0.1875, 0.4375}, -- NodeBox6
{0.3225, -0.3125, 0.32, 0.365, -0.1875, 0.4375}, -- NodeBox7
}
},
selection_box = {
type = "fixed",
fixed = { -0.45, -0.5, -0.5, 0.45, 0.35, 1.5 }
},
expand = { forward="homedecor:deckchair_head" },
})
homedecor.register("doghouse_base", {
tiles = {
"homedecor_doghouse_base_top.png",
"homedecor_doghouse_base_bottom.png",
"homedecor_doghouse_base_side.png",
"homedecor_doghouse_base_side.png",
"homedecor_doghouse_base_side.png",
"homedecor_doghouse_base_front.png"
},
description = "Doghouse",
inventory_image = "homedecor_doghouse_inv.png",
node_box = {
type = "fixed",
fixed = {
{0.3125, -0.5, -0.4375, 0.4375, -0.3125, -0.3125}, -- NodeBox1
{0.3125, -0.5, 0.3125, 0.4375, -0.3125, 0.4375}, -- NodeBox2
{-0.4375, -0.5, 0.3125, -0.3125, -0.3125, 0.4375}, -- NodeBox3
{-0.4375, -0.5, -0.4375, -0.3125, -0.3125, -0.3125}, -- NodeBox4
{-0.4375, -0.3125, -0.4375, -0.375, 0.5, 0.4375}, -- NodeBox5
{-0.4375, 0.3125, -0.375, 0.4375, 0.5, -0.3125}, -- NodeBox6
{-0.4375, -0.3125, -0.4375, 0.4375, -0.25, 0.4375}, -- NodeBox7
{-0.375, -0.3125, -0.375, -0.1875, 0.4375, -0.3125}, -- NodeBox8
{0.1875, -0.3125, -0.375, 0.4375, 0.5, -0.3125}, -- NodeBox9
{0.375, -0.25, -0.4375, 0.4375, 0.5, 0.4375}, -- NodeBox10
{-0.4375, -0.3125, 0.375, 0.4375, 0.5, 0.4375}, -- NodeBox11
}
},
selection_box = homedecor.nodebox.slab_y(1.5),
groups = {snappy=3},
expand = { top="homedecor:doghouse_roof" },
})
homedecor.register("doghouse_roof", {
tiles = {
"homedecor_doghouse_roof_top.png",
"homedecor_doghouse_roof_bottom.png",
"homedecor_doghouse_roof_side.png",
"homedecor_doghouse_roof_side.png",
"homedecor_doghouse_roof_front.png",
"homedecor_doghouse_roof_front.png"
},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.4375, -0.4375, 0.5}, -- NodeBox17
{-0.4375, -0.4375, -0.5, -0.375, -0.375, 0.5}, -- NodeBox18
{-0.375, -0.375, -0.5, -0.3125, -0.3125, 0.5}, -- NodeBox19
{-0.3125, -0.3125, -0.5, -0.25, -0.25, 0.5}, -- NodeBox20
{-0.25, -0.25, -0.5, -0.1875, -0.1875, 0.5}, -- NodeBox21
{-0.1875, -0.1875, -0.5, -0.125, -0.125, 0.5}, -- NodeBox22
{-0.125, -0.125, -0.5, -0.0625, -0.0625, 0.5}, -- NodeBox23
{-0.0625, -0.0625, -0.5, 0.0625, 0, 0.5}, -- NodeBox24
{0.0625, -0.125, -0.5, 0.125, -0.0625, 0.5}, -- NodeBox25
{0.125, -0.1875, -0.5, 0.1875, -0.125, 0.5}, -- NodeBox26
{0.1875, -0.25, -0.5, 0.25, -0.1875, 0.5}, -- NodeBox27
{0.25, -0.3125, -0.5, 0.3125, -0.25, 0.5}, -- NodeBox28
{0.3125, -0.375, -0.5, 0.375, -0.3125, 0.5}, -- NodeBox29
{0.375, -0.4375, -0.5, 0.4375, -0.375, 0.5}, -- NodeBox30
{0.4375, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox31
{-0.4375, -0.5, -0.375, 0.4375, -0.4375, 0.4375}, -- NodeBox32
{-0.375, -0.4375, -0.375, 0.375, -0.375, 0.4375}, -- NodeBox33
{-0.3125, -0.375, -0.375, 0.3125, -0.3125, 0.4375}, -- NodeBox34
{-0.25, -0.3125, -0.375, 0.25, -0.25, 0.4375}, -- NodeBox35
{-0.1875, -0.25, -0.375, 0.1875, -0.1875, 0.4375}, -- NodeBox36
{-0.125, -0.1875, -0.375, 0.125, -0.125, 0.4375}, -- NodeBox37
{0.0625, -0.125, -0.375, -0.0625, -0.0625, 0.4375}, -- NodeBox38
}
},
selection_box = homedecor.nodebox.null,
groups = {snappy=3, not_in_creative_inventory=1},
})
homedecor.register("simple_bench", {
tiles = {
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_bench_large_2_left_back.png",
"homedecor_bench_large_2_left_back.png^[transformFX"
},
description = "Simple Bench",
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.15, 0, 0.5, -0.05, 0.4},
{-0.4, -0.5, 0.1, -0.3, -0.15, 0.3},
{ 0.3, -0.5, 0.1, 0.4, -0.15, 0.3},
}
},
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
homedecor.register("stonepath", {
description = "Garden stone path",
tiles = {
"default_stone.png"
},
inventory_image = "homedecor_stonepath_inv.png",
groups = { snappy=3 },
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, 0.3125, -0.3125, -0.48, 0.4375}, -- NodeBox1
{-0.25, -0.5, 0.125, 0, -0.48, 0.375}, -- NodeBox2
{0.125, -0.5, 0.125, 0.4375, -0.48, 0.4375}, -- NodeBox3
{-0.4375, -0.5, -0.125, -0.25, -0.48, 0.0625}, -- NodeBox4
{-0.0625, -0.5, -0.25, 0.25, -0.48, 0.0625}, -- NodeBox5
{0.3125, -0.5, -0.25, 0.4375, -0.48, -0.125}, -- NodeBox6
{-0.3125, -0.5, -0.375, -0.125, -0.48, -0.1875}, -- NodeBox7
{0.125, -0.5, -0.4375, 0.25, -0.48, -0.3125}, -- NodeBox8
}
},
selection_box = {
type = "fixed",
fixed = { -0.4375, -0.5, -0.4375, 0.4375, -0.4, 0.4375 }
}
})
homedecor.register("swing", {
description = "Tree's swing",
tiles = {
"homedecor_swing_top.png",
"homedecor_swing_top.png^[transformR180",
"homedecor_swing_top.png"
},
inventory_image = "homedecor_swing_inv.png",
groups = { snappy=3, oddly_breakable_by_hand=3 },
node_box = {
type = "fixed",
fixed = {
{-0.3125, 0.33, -0.125, 0.3125, 0.376, 0.1875}, -- NodeBox1
{-0.3125, 0.376, 0.025, -0.3, 0.5, 0.0375}, -- NodeBox2
{ 0.3, 0.376, 0.025, 0.3125, 0.5, 0.0375}, -- NodeBox3
}
},
selection_box = {
type = "fixed",
fixed = { -0.3125, 0.33, -0.125, 0.3125, 0.5, 0.1875 }
},
on_place = function(itemstack, placer, pointed_thing)
isceiling, pos = homedecor.find_ceiling(itemstack, placer, pointed_thing)
if isceiling then
local height = 0
for i = 0, 4 do -- search up to 5 spaces downward from the ceiling for the first non-buildable-to node...
height = i
local testpos = { x=pos.x, y=pos.y-i-1, z=pos.z }
local testnode = minetest.get_node(testpos)
local testreg = core.registered_nodes[testnode.name]
if not testreg.buildable_to then
if i < 1 then
minetest.chat_send_player(placer:get_player_name(), "No room under there to hang a swing.")
return
else
break
end
end
end
for j = 0, height do -- then fill that space with ropes...
local testpos = { x=pos.x, y=pos.y-j, z=pos.z }
local testnode = minetest.get_node(testpos)
local testreg = core.registered_nodes[testnode.name]
minetest.set_node(testpos, { name = "homedecor:swing_rope", param2 = fdir })
end
minetest.set_node({ x=pos.x, y=pos.y-height, z=pos.z }, { name = "homedecor:swing", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
else
minetest.chat_send_player(placer:get_player_name(), "You have to point at the bottom side of an overhanging object to place a swing.")
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
for i = 0, 4 do
local testpos = { x=pos.x, y=pos.y+i+1, z=pos.z }
if minetest.get_node(testpos).name == "homedecor:swing_rope" then
minetest.remove_node(testpos)
else
return
end
end
end
})
homedecor.register("swing_rope", {
tiles = {
"homedecor_swingrope_sides.png"
},
groups = { not_in_creative_inventory=1 },
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, 0.025, -0.3, 0.5, 0.0375}, -- NodeBox1
{0.3, -0.5, 0.025, 0.3125, 0.5, 0.0375}, -- NodeBox2
}
},
selection_box = homedecor.nodebox.null
})
homedecor.register("well_base", {
tiles = {
"homedecor_well_base_top.png",
"default_cobble.png"
},
inventory_image = "homedecor_well_inv.png",
description = "Water well",
groups = { snappy = 3 },
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.4375, 0.3125, 0.5, -0.3125}, -- NodeBox1
{0.3125, -0.5, -0.3125, 0.4375, 0.5, 0.3125}, -- NodeBox2
{-0.4375, -0.5, -0.3125, -0.3125, 0.5, 0.3125}, -- NodeBox3
{-0.3125, -0.5, 0.3125, 0.3125, 0.5, 0.4375}, -- NodeBox4
{0.25, -0.5, -0.375, 0.375, 0.5, -0.25}, -- NodeBox5
{0.25, -0.5, 0.25, 0.375, 0.5, 0.375}, -- NodeBox6
{-0.375, -0.5, -0.375, -0.25, 0.5, -0.25}, -- NodeBox7
{-0.375, -0.5, 0.25, -0.25, 0.5, 0.375}, -- NodeBox8
{-0.3125, -0.5, -0.5, 0.3125, -0.3125, -0.4375}, -- NodeBox9
{0.4375, -0.5, -0.3125, 0.5, -0.3125, 0.3125}, -- NodeBox10
{-0.3125, -0.5, 0.4375, 0.3125, -0.3125, 0.5}, -- NodeBox11
{-0.5, -0.5, -0.3125, -0.4375, -0.3125, 0.3125}, -- NodeBox12
{0.3125, -0.5, -0.4375, 0.4375, -0.3125, -0.3125}, -- NodeBox13
{0.3125, -0.5, 0.3125, 0.4375, -0.3125, 0.4375}, -- NodeBox14
{-0.4375, -0.5, 0.3125, -0.3125, -0.3125, 0.4375}, -- NodeBox15
{-0.4375, -0.5, -0.4375, -0.3125, -0.3125, -0.3125}, -- NodeBox16
{-0.3125, -0.5, -0.3125, 0.3125, 0, 0.3125}, -- NodeBox17
}
},
selection_box = homedecor.nodebox.slab_y(2),
expand = { top="homedecor:well_top" },
})
homedecor.register("well_top", {
tiles = {
"homedecor_well_roof_top.png",
"homedecor_well_roof_wood.png",
"homedecor_well_roof_side3.png",
"homedecor_well_roof_side3.png",
"homedecor_well_roof_side2.png",
"homedecor_well_roof_side1.png"
},
groups = { snappy = 3 },
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, 0.375, 0.0625, 0.4375, 0.4375}, -- NodeBox1
{-0.0625, -0.5, -0.4375, 0.0625, 0.4375, -0.375}, -- NodeBox2
{-0.125, 0.375, -0.5, 0.125, 0.4375, 0.5}, -- NodeBox3
{0.125, 0.3125, -0.5, 0.1875, 0.375, 0.5}, -- NodeBox4
{-0.1875, 0.3125, -0.5, -0.125, 0.375, 0.5}, -- NodeBox5
{0.1875, 0.25, -0.5, 0.25, 0.3125, 0.5}, -- NodeBox6
{-0.25, 0.25, -0.5, -0.1875, 0.3125, 0.5}, -- NodeBox7
{0.25, 0.1875, -0.5, 0.3125, 0.25, 0.5}, -- NodeBox8
{-0.3125, 0.1875, -0.5, -0.25, 0.25, 0.5}, -- NodeBox9
{0.3125, 0.125, -0.5, 0.375, 0.1875, 0.5}, -- NodeBox10
{-0.375, 0.125, -0.5, -0.3125, 0.1875, 0.5}, -- NodeBox11
{0.375, 0.0625, -0.5, 0.4375, 0.125, 0.5}, -- NodeBox12
{-0.375, 0.0625, -0.5, -0.4375, 0.125, 0.5}, -- NodeBox13
{0.4375, 0, -0.5, 0.5, 0.0625, 0.5}, -- NodeBox14
{-0.5, 0, -0.5, -0.4375, 0.0625, 0.5}, -- NodeBox15
{-0.0625, 0.4375, -0.5, 0.0625, 0.5, 0.5}, -- NodeBox16
{-0.125, 0.125, -0.4375, 0.125, 0.1875, -0.375}, -- NodeBox17
{0.125, 0.1875, -0.4375, 0.1875, 0.25, -0.375}, -- NodeBox18
{-0.1875, 0.1875, -0.4375, -0.125, 0.25, -0.375}, -- NodeBox19
{-0.125, 0.125, 0.375, 0.125, 0.1875, 0.4375}, -- NodeBox20
{0.125, 0.1875, 0.375, 0.1875, 0.25, 0.4375}, -- NodeBox21
{-0.1875, 0.1875, 0.375, -0.125, 0.25, 0.4375}, -- NodeBox22
{-0.0165975, -0.159751, -0.375, 0.0165974, -0.125, 0.375}, -- NodeBox23
{-0.00414942, -0.465, -0.008299, 0.008299, -0.159751, 0.004149}, -- NodeBox24
{-0.0625, -0.0625, -0.5, 0.0625, 0, -0.4646}, -- NodeBox25
{0.0625, -0.125, -0.5, 0.125, -0.0625, -0.4646}, -- NodeBox26
{0.125, -0.25, -0.5, 0.1875, -0.125, -0.4646}, -- NodeBox27
{0.0625, -0.3125, -0.5, 0.125, -0.25, -0.4646}, -- NodeBox28
{-0.0625, -0.375, -0.5, 0.0625, -0.3125, -0.4646}, -- NodeBox29
{-0.0625, -0.3125, -0.5, -0.125, -0.25, -0.4646}, -- NodeBox30
{-0.1875, -0.25, -0.5, -0.125, -0.125, -0.4646}, -- NodeBox31
{-0.125, -0.125, -0.5, -0.0625, -0.0625, -0.4646}, -- NodeBox32
{-0.016598, -0.3125, -0.48, 0.020747, -0.0625, -0.49}, -- NodeBox33
{-0.125, -0.209544, -0.48, 0.125, -0.172199, -0.49}, -- NodeBox34
{-0.0165975, -0.200, -0.477178, 0.020747, -0.175349, -0.435685}, -- NodeBox35
{0.1, -0.75, -0.125, 0.125, -0.5, 0.125}, -- NodeBox36
{-0.125, -0.75, -0.125, -0.1, -0.5, 0.125}, -- NodeBox37
{-0.125, -0.75, -0.125, 0.125, -0.729253, 0.125}, -- NodeBox38
{-0.125, -0.75, -0.125, 0.125, -0.5, -0.1}, -- NodeBox39
{-0.125, -0.75, 0.1, 0.125, -0.5, 0.125}, -- NodeBox40
{-0.0165975,-0.465, -0.125, 0.0165974, -0.451245, 0.125}, -- NodeBox41
{-0.0165975, -0.51, 0.112033, 0.0165974, -0.46, 0.125}, -- NodeBox42
{-0.0165975, -0.51, -0.125, 0.0165974, -0.46, -0.112033}, -- NodeBox43
}
},
selection_box = homedecor.nodebox.null,
})

View File

@ -1,6 +1,44 @@
local S = homedecor.gettext local S = homedecor.gettext
-- 3dforniture tables ... well, they used to be :P function sit(pos, node, clicker)
local name = clicker:get_player_name()
local meta = minetest:get_meta(pos)
local param2 = node.param2
if clicker:get_player_name() == meta:get_string("player") then
meta:set_string("player", "")
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
clicker:set_physics_override(1, 1, 1)
default.player_attached[name] = false
default.player_set_animation(clicker, "stand", 30)
else
meta:set_string("player", clicker:get_player_name())
clicker:set_eye_offset({x=0,y=-7,z=2}, {x=0,y=0,z=0})
clicker:set_physics_override(0, 0, 0)
default.player_attached[name] = true
if param2 == 1 then
clicker:set_look_yaw(7.9)
elseif param2 == 3 then
clicker:set_look_yaw(4.75)
elseif param2 == 0 then
clicker:set_look_yaw(3.15)
else
clicker:set_look_yaw(6.28)
end
end
end
function sit_exec(pos, node, clicker) -- don't move these functions inside sit()
if not clicker or not clicker:is_player()
or clicker:get_player_control().up == true or clicker:get_player_control().down == true
or clicker:get_player_control().left == true or clicker:get_player_control().right == true
or clicker:get_player_control().jump == true then -- make sure that the player is immobile.
return end
sit(pos, node, clicker)
clicker:setpos(pos)
default.player_set_animation(clicker, "sit", 30)
end
local table_colors = { "", "mahogany", "white" } local table_colors = { "", "mahogany", "white" }
@ -34,46 +72,6 @@ for _, i in ipairs(table_colors) do
}) })
end end
local function sit(pos, node, clicker)
local name = clicker:get_player_name()
local meta = minetest:get_meta(pos)
local param2 = node.param2
if clicker:get_player_name() == meta:get_string("player") then
meta:set_string("player", "")
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
clicker:set_physics_override(1, 1, 1)
default.player_attached[name] = false
default.player_set_animation(clicker, "stand", 30)
else
meta:set_string("player", clicker:get_player_name())
clicker:set_eye_offset({x=0,y=-7,z=2}, {x=0,y=0,z=0})
clicker:set_physics_override(0, 0, 0)
default.player_attached[name] = true
if param2 == 1 then
clicker:set_look_yaw(7.9)
elseif param2 == 3 then
clicker:set_look_yaw(4.75)
elseif param2 == 0 then
clicker:set_look_yaw(3.15)
else
clicker:set_look_yaw(6.28)
end
end
end
local function sit_exec(pos, node, clicker) -- don't move these functions inside sit()
if not clicker or not clicker:is_player()
or clicker:get_player_control().up == true or clicker:get_player_control().down == true
or clicker:get_player_control().left == true or clicker:get_player_control().right == true
or clicker:get_player_control().jump == true then -- make sure that the player is immobile.
return end
sit(pos, node, clicker)
clicker:setpos(pos)
default.player_set_animation(clicker, "sit", 30)
end
local chaircolors = { local chaircolors = {
{ "", "plain" }, { "", "plain" },
{ "black", "Black" }, { "black", "Black" },
@ -385,232 +383,6 @@ homedecor.register("wardrobe_bottom", {
}, },
}) })
homedecor.register("simple_bench", {
tiles = {
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_bench_large_2_left_back.png",
"homedecor_bench_large_2_left_back.png^[transformFX"
},
description = "Simple Bench",
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.15, 0, 0.5, -0.05, 0.4},
{-0.4, -0.5, 0.1, -0.3, -0.15, 0.3},
{ 0.3, -0.5, 0.1, 0.4, -0.15, 0.3},
}
},
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
homedecor.register("bench_large_1_left", {
description = "Garden Bench (style 1)",
tiles = {
"homedecor_bench_large_1_left_top.png",
"homedecor_bench_large_1_left_bottom.png",
"homedecor_bench_large_1_ends.png^[transformFX",
"homedecor_bench_large_1_ends.png",
"homedecor_bench_large_1_left_back.png",
"homedecor_bench_large_1_left_front.png"
},
inventory_image = "homedecor_bench_large_1_inv.png",
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.25, 0.375, 0.5, 0.4375, 0.4375}, -- NodeBox1
{-0.5, 0, 0.375, 0.5, 0.1875, 0.4375}, -- NodeBox2
{-0.5, -0.125, 0.115, 0.5, -0.0625, 0.35}, -- NodeBox3
{-0.5, -0.125, -0.0872, 0.5, -0.0625, 0.079}, -- NodeBox4
{-0.3125, -0.5, 0.4375, -0.25, 0.375, 0.5}, -- NodeBox5
{-0.3125, -0.25, -0.0625, -0.25, -0.125, 0.4375}, -- NodeBox6
{-0.3125, -0.5, -0.0625, -0.25, -0.25, 0}, -- NodeBox7
}
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.09375, 1.5, 0.5, 0.5 }
},
expand = { right="homedecor:bench_large_1_right" },
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
homedecor.register("bench_large_1_right", {
tiles = {
"homedecor_bench_large_1_left_top.png^[transformFX",
"homedecor_bench_large_1_left_bottom.png^[transformFX",
"homedecor_bench_large_1_ends.png^[transformFX",
"homedecor_bench_large_1_ends.png",
"homedecor_bench_large_1_left_back.png^[transformFX",
"homedecor_bench_large_1_left_front.png^[transformFX"
},
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.25, 0.375, 0.5, 0.4375, 0.4375}, -- NodeBox1
{-0.5, 0, 0.375, 0.5, 0.1875, 0.4375}, -- NodeBox2
{-0.5, -0.125, 0.115, 0.5, -0.0625, 0.35}, -- NodeBox3
{-0.5, -0.125, -0.0872, 0.5, -0.0625, 0.079}, -- NodeBox4
{0.25, -0.5, 0.4375, 0.3125, 0.375, 0.5}, -- NodeBox5
{0.25, -0.25, -0.0625, 0.3125, -0.125, 0.5}, -- NodeBox6
{0.25, -0.5, -0.0625, 0.3125, -0.25, 0}, -- NodeBox7
}
},
selection_box = homedecor.nodebox.null,
})
homedecor.register("bench_large_2_left", {
description = "Garden Bench (style 2)",
tiles = {
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_bench_large_2_left_back.png",
"homedecor_bench_large_2_left_back.png^[transformFX"
},
inventory_image = "homedecor_bench_large_2_inv.png",
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.375, -0.375, 0.5, 0.5}, -- NodeBox1
{-0.375, 0.3125, 0.4375, 0.5, 0.4375, 0.5}, -- NodeBox2
{-0.375, -0.0625, 0.4375, 0.5, 0.0625, 0.5}, -- NodeBox3
{-0.3125, 0.0625, 0.45, -0.25, 0.3125, 0.48}, -- NodeBox4
{-0.1875, 0.0625, 0.45, -0.125, 0.3125, 0.48}, -- NodeBox5
{-0.0625, 0.0625, 0.45, 0, 0.3125, 0.48}, -- NodeBox6
{0.0625, 0.0625, 0.45, 0.125, 0.3125, 0.48}, -- NodeBox7
{0.1875, 0.0625, 0.45, 0.25, 0.3125, 0.48}, -- NodeBox8
{0.3125, 0.0625, 0.45, 0.375, 0.3125, 0.48}, -- NodeBox9
{0.4375, 0.0625, 0.45, 0.5, 0.3125, 0.48}, -- NodeBox10
{-0.5, 0.0625, -0.145362, -0.375, 0.125, 0.375}, -- NodeBox11
{-0.5, -0.5, -0.0625, -0.375, 0.0625, 0.0625}, -- NodeBox12
{-0.4375, -0.125, -0.0625, 0.5, -0.0911603, 0.4375}, -- NodeBox13
{-0.4375, -0.4375, 0.0625, -0.375, -0.3125, 0.375}, -- NodeBox14
{-0.375, -0.342324, 0.25, 0.5, -0.4375, 0.1875}, -- NodeBox15
{-0.5, -0.25, -0.0290173, 0.5, -0.125, 0.0125346}, -- NodeBox16
}
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.15625, 1.5, 0.5, 0.5 }
},
expand = { right="homedecor:bench_large_2_right" },
on_rightclick = function(pos, node, clicker)
pos.y = pos.y-0 -- player's sit position.
sit_exec(pos, node, clicker)
end,
})
homedecor.register("bench_large_2_right", {
tiles = {
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_generic_wood.png",
"homedecor_bench_large_2_right_back.png",
"homedecor_bench_large_2_right_back.png^[transformFX"
},
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{0.375, -0.5, 0.375, 0.5, 0.5, 0.5}, -- NodeBox1
{-0.5, 0.3125, 0.4375, 0.375, 0.4375, 0.5}, -- NodeBox2
{-0.5, -0.0625, 0.4375, 0.375, 0.0625, 0.5}, -- NodeBox3
{-0.5, 0.0625, 0.45, -0.4375, 0.3125, 0.48}, -- NodeBox4
{-0.375, 0.0625, 0.45, -0.3125, 0.3125, 0.48}, -- NodeBox5
{-0.25, 0.0625, 0.45, -0.1875, 0.3125, 0.48}, -- NodeBox6
{-0.125, 0.0625, 0.45, -0.0625, 0.3125, 0.48}, -- NodeBox7
{0, 0.0625, 0.45, 0.0625, 0.3125, 0.48}, -- NodeBox8
{0.125, 0.0625, 0.45, 0.1875, 0.3125, 0.48}, -- NodeBox9
{0.25, 0.0625, 0.45, 0.3125, 0.3125, 0.48}, -- NodeBox10
{0.375, 0.0625, -0.145362, 0.5, 0.125, 0.375}, -- NodeBox11
{0.375, -0.5, -0.0625, 0.5, 0.125, 0.0625}, -- NodeBox12
{0.375, -0.4375, 0.0625, 0.4375, -0.3125, 0.375}, -- NodeBox13
{-0.5, -0.4375, 0.1875, 0.375, -0.342324, 0.25}, -- NodeBox14
{-0.5, -0.125, -0.0625, 0.4375, -0.0911603, 0.4375}, -- NodeBox15
{-0.5, -0.25, -0.0290173, 0.5, -0.125, 0.0125346}, -- NodeBox16
}
},
selection_box = homedecor.nodebox.null,
})
homedecor.register("deckchair_head", {
tiles = {
"homedecor_deckchair_top_c1.png",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_sides.png^[transformFX",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_front.png"
},
groups = { snappy = 3, not_in_creative_inventory = 1 },
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.3125, -0.0625, 0.375, -0.25, 0}, -- NodeBox1
{-0.375, -0.25, 0, 0.375, -0.1875, 0.0625}, -- NodeBox2
{-0.375, -0.1875, 0.0625, 0.375, -0.125, 0.125}, -- NodeBox3
{-0.375, -0.125, 0.125, 0.375, -0.0625, 0.1875}, -- NodeBox4
{-0.375, -0.0625, 0.1875, 0.375, 0, 0.25}, -- NodeBox5
{-0.375, 0, 0.25, 0.375, 0.0625, 0.3125}, -- NodeBox6
{-0.375, 0.0625, 0.3125, 0.375, 0.125, 0.375}, -- NodeBox7
{-0.375, 0.125, 0.375, 0.375, 0.1875, 0.4375}, -- NodeBox8
{-0.375, 0.1875, 0.4375, 0.375, 0.25, 0.5}, -- NodeBox9
{-0.375, -0.375, -0.5, 0.375, -0.3125, 0.0625}, -- NodeBox10
{0.3125, -0.1875, -0.5, 0.4375, -0.1575, 0.0625}, -- NodeBox11
{-0.4375, -0.1875, -0.5, -0.3125, -0.1575, 0.0625}, -- NodeBox12
{0.3125, -0.5, 0, 0.375, -0.25, 0.0625}, -- NodeBox13
{-0.375, -0.5, 0, -0.3125, -0.25, 0.0625}, -- NodeBox14
}
},
selection_box = homedecor.nodebox.null
})
homedecor.register("deckchair_foot", {
tiles = {
"homedecor_deckchair_top_c2.png",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_sides.png^[transformFX",
"homedecor_deckchair_front.png"
},
description = "Deck chair",
inventory_image = "homedecor_deckchair_inv.png",
groups = { snappy = 3 },
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.375, -0.5, 0.375, -0.3125, 0.5}, -- NodeBox1
{0.3125, -0.5, -0.5, 0.375, -0.375, -0.4375}, -- NodeBox2
{-0.375, -0.5, -0.5, -0.3125, -0.375, -0.4375}, -- NodeBox3
{0.3125, -0.1875, 0.3, 0.4375, -0.1575, 0.5}, -- NodeBox4
{-0.4375, -0.1875, 0.3, -0.3125, -0.1575, 0.5}, -- NodeBox5
{-0.365, -0.3125, 0.32, -0.3225, -0.1875, 0.4375}, -- NodeBox6
{0.3225, -0.3125, 0.32, 0.365, -0.1875, 0.4375}, -- NodeBox7
}
},
selection_box = {
type = "fixed",
fixed = { -0.45, -0.5, -0.5, 0.45, 0.35, 1.5 }
},
expand = { forward="homedecor:deckchair_head" },
})
homedecor.register("wall_shelf", { homedecor.register("wall_shelf", {
description = "Wall Shelf", description = "Wall Shelf",
tiles = { tiles = {

View File

@ -147,6 +147,8 @@ dofile(homedecor.modpath.."/furniture_recipes.lua")
dofile(homedecor.modpath.."/climate-control.lua") dofile(homedecor.modpath.."/climate-control.lua")
dofile(homedecor.modpath.."/cobweb.lua") dofile(homedecor.modpath.."/cobweb.lua")
dofile(homedecor.modpath.."/books.lua")
dofile(homedecor.modpath.."/exterior.lua")
dofile(homedecor.modpath.."/handlers/locked.lua") dofile(homedecor.modpath.."/handlers/locked.lua")

View File

@ -338,78 +338,6 @@ homedecor.register("filing_cabinet", {
}, },
}) })
homedecor.register("doghouse_base", {
tiles = {
"homedecor_doghouse_base_top.png",
"homedecor_doghouse_base_bottom.png",
"homedecor_doghouse_base_side.png",
"homedecor_doghouse_base_side.png",
"homedecor_doghouse_base_side.png",
"homedecor_doghouse_base_front.png"
},
description = "Doghouse",
inventory_image = "homedecor_doghouse_inv.png",
node_box = {
type = "fixed",
fixed = {
{0.3125, -0.5, -0.4375, 0.4375, -0.3125, -0.3125}, -- NodeBox1
{0.3125, -0.5, 0.3125, 0.4375, -0.3125, 0.4375}, -- NodeBox2
{-0.4375, -0.5, 0.3125, -0.3125, -0.3125, 0.4375}, -- NodeBox3
{-0.4375, -0.5, -0.4375, -0.3125, -0.3125, -0.3125}, -- NodeBox4
{-0.4375, -0.3125, -0.4375, -0.375, 0.5, 0.4375}, -- NodeBox5
{-0.4375, 0.3125, -0.375, 0.4375, 0.5, -0.3125}, -- NodeBox6
{-0.4375, -0.3125, -0.4375, 0.4375, -0.25, 0.4375}, -- NodeBox7
{-0.375, -0.3125, -0.375, -0.1875, 0.4375, -0.3125}, -- NodeBox8
{0.1875, -0.3125, -0.375, 0.4375, 0.5, -0.3125}, -- NodeBox9
{0.375, -0.25, -0.4375, 0.4375, 0.5, 0.4375}, -- NodeBox10
{-0.4375, -0.3125, 0.375, 0.4375, 0.5, 0.4375}, -- NodeBox11
}
},
selection_box = homedecor.nodebox.slab_y(1.5),
groups = {snappy=3},
expand = { top="homedecor:doghouse_roof" },
})
homedecor.register("doghouse_roof", {
tiles = {
"homedecor_doghouse_roof_top.png",
"homedecor_doghouse_roof_bottom.png",
"homedecor_doghouse_roof_side.png",
"homedecor_doghouse_roof_side.png",
"homedecor_doghouse_roof_front.png",
"homedecor_doghouse_roof_front.png"
},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.4375, -0.4375, 0.5}, -- NodeBox17
{-0.4375, -0.4375, -0.5, -0.375, -0.375, 0.5}, -- NodeBox18
{-0.375, -0.375, -0.5, -0.3125, -0.3125, 0.5}, -- NodeBox19
{-0.3125, -0.3125, -0.5, -0.25, -0.25, 0.5}, -- NodeBox20
{-0.25, -0.25, -0.5, -0.1875, -0.1875, 0.5}, -- NodeBox21
{-0.1875, -0.1875, -0.5, -0.125, -0.125, 0.5}, -- NodeBox22
{-0.125, -0.125, -0.5, -0.0625, -0.0625, 0.5}, -- NodeBox23
{-0.0625, -0.0625, -0.5, 0.0625, 0, 0.5}, -- NodeBox24
{0.0625, -0.125, -0.5, 0.125, -0.0625, 0.5}, -- NodeBox25
{0.125, -0.1875, -0.5, 0.1875, -0.125, 0.5}, -- NodeBox26
{0.1875, -0.25, -0.5, 0.25, -0.1875, 0.5}, -- NodeBox27
{0.25, -0.3125, -0.5, 0.3125, -0.25, 0.5}, -- NodeBox28
{0.3125, -0.375, -0.5, 0.375, -0.3125, 0.5}, -- NodeBox29
{0.375, -0.4375, -0.5, 0.4375, -0.375, 0.5}, -- NodeBox30
{0.4375, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox31
{-0.4375, -0.5, -0.375, 0.4375, -0.4375, 0.4375}, -- NodeBox32
{-0.375, -0.4375, -0.375, 0.375, -0.375, 0.4375}, -- NodeBox33
{-0.3125, -0.375, -0.375, 0.3125, -0.3125, 0.4375}, -- NodeBox34
{-0.25, -0.3125, -0.375, 0.25, -0.25, 0.4375}, -- NodeBox35
{-0.1875, -0.25, -0.375, 0.1875, -0.1875, 0.4375}, -- NodeBox36
{-0.125, -0.1875, -0.375, 0.125, -0.125, 0.4375}, -- NodeBox37
{0.0625, -0.125, -0.375, -0.0625, -0.0625, 0.4375}, -- NodeBox38
}
},
selection_box = homedecor.nodebox.null,
groups = {snappy=3, not_in_creative_inventory=1},
})
homedecor.register("pool_table", { homedecor.register("pool_table", {
tiles = { tiles = {
"homedecor_pool_table_top1.png", "homedecor_pool_table_top1.png",
@ -514,101 +442,6 @@ homedecor.register("trash_can", {
collision_box = trash_cbox, collision_box = trash_cbox,
}) })
homedecor.register("well_base", {
tiles = {
"homedecor_well_base_top.png",
"default_cobble.png"
},
inventory_image = "homedecor_well_inv.png",
description = "Water well",
groups = { snappy = 3 },
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.4375, 0.3125, 0.5, -0.3125}, -- NodeBox1
{0.3125, -0.5, -0.3125, 0.4375, 0.5, 0.3125}, -- NodeBox2
{-0.4375, -0.5, -0.3125, -0.3125, 0.5, 0.3125}, -- NodeBox3
{-0.3125, -0.5, 0.3125, 0.3125, 0.5, 0.4375}, -- NodeBox4
{0.25, -0.5, -0.375, 0.375, 0.5, -0.25}, -- NodeBox5
{0.25, -0.5, 0.25, 0.375, 0.5, 0.375}, -- NodeBox6
{-0.375, -0.5, -0.375, -0.25, 0.5, -0.25}, -- NodeBox7
{-0.375, -0.5, 0.25, -0.25, 0.5, 0.375}, -- NodeBox8
{-0.3125, -0.5, -0.5, 0.3125, -0.3125, -0.4375}, -- NodeBox9
{0.4375, -0.5, -0.3125, 0.5, -0.3125, 0.3125}, -- NodeBox10
{-0.3125, -0.5, 0.4375, 0.3125, -0.3125, 0.5}, -- NodeBox11
{-0.5, -0.5, -0.3125, -0.4375, -0.3125, 0.3125}, -- NodeBox12
{0.3125, -0.5, -0.4375, 0.4375, -0.3125, -0.3125}, -- NodeBox13
{0.3125, -0.5, 0.3125, 0.4375, -0.3125, 0.4375}, -- NodeBox14
{-0.4375, -0.5, 0.3125, -0.3125, -0.3125, 0.4375}, -- NodeBox15
{-0.4375, -0.5, -0.4375, -0.3125, -0.3125, -0.3125}, -- NodeBox16
{-0.3125, -0.5, -0.3125, 0.3125, 0, 0.3125}, -- NodeBox17
}
},
selection_box = homedecor.nodebox.slab_y(2),
expand = { top="homedecor:well_top" },
})
homedecor.register("well_top", {
tiles = {
"homedecor_well_roof_top.png",
"homedecor_well_roof_wood.png",
"homedecor_well_roof_side3.png",
"homedecor_well_roof_side3.png",
"homedecor_well_roof_side2.png",
"homedecor_well_roof_side1.png"
},
groups = { snappy = 3 },
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, 0.375, 0.0625, 0.4375, 0.4375}, -- NodeBox1
{-0.0625, -0.5, -0.4375, 0.0625, 0.4375, -0.375}, -- NodeBox2
{-0.125, 0.375, -0.5, 0.125, 0.4375, 0.5}, -- NodeBox3
{0.125, 0.3125, -0.5, 0.1875, 0.375, 0.5}, -- NodeBox4
{-0.1875, 0.3125, -0.5, -0.125, 0.375, 0.5}, -- NodeBox5
{0.1875, 0.25, -0.5, 0.25, 0.3125, 0.5}, -- NodeBox6
{-0.25, 0.25, -0.5, -0.1875, 0.3125, 0.5}, -- NodeBox7
{0.25, 0.1875, -0.5, 0.3125, 0.25, 0.5}, -- NodeBox8
{-0.3125, 0.1875, -0.5, -0.25, 0.25, 0.5}, -- NodeBox9
{0.3125, 0.125, -0.5, 0.375, 0.1875, 0.5}, -- NodeBox10
{-0.375, 0.125, -0.5, -0.3125, 0.1875, 0.5}, -- NodeBox11
{0.375, 0.0625, -0.5, 0.4375, 0.125, 0.5}, -- NodeBox12
{-0.375, 0.0625, -0.5, -0.4375, 0.125, 0.5}, -- NodeBox13
{0.4375, 0, -0.5, 0.5, 0.0625, 0.5}, -- NodeBox14
{-0.5, 0, -0.5, -0.4375, 0.0625, 0.5}, -- NodeBox15
{-0.0625, 0.4375, -0.5, 0.0625, 0.5, 0.5}, -- NodeBox16
{-0.125, 0.125, -0.4375, 0.125, 0.1875, -0.375}, -- NodeBox17
{0.125, 0.1875, -0.4375, 0.1875, 0.25, -0.375}, -- NodeBox18
{-0.1875, 0.1875, -0.4375, -0.125, 0.25, -0.375}, -- NodeBox19
{-0.125, 0.125, 0.375, 0.125, 0.1875, 0.4375}, -- NodeBox20
{0.125, 0.1875, 0.375, 0.1875, 0.25, 0.4375}, -- NodeBox21
{-0.1875, 0.1875, 0.375, -0.125, 0.25, 0.4375}, -- NodeBox22
{-0.0165975, -0.159751, -0.375, 0.0165974, -0.125, 0.375}, -- NodeBox23
{-0.00414942, -0.465, -0.008299, 0.008299, -0.159751, 0.004149}, -- NodeBox24
{-0.0625, -0.0625, -0.5, 0.0625, 0, -0.4646}, -- NodeBox25
{0.0625, -0.125, -0.5, 0.125, -0.0625, -0.4646}, -- NodeBox26
{0.125, -0.25, -0.5, 0.1875, -0.125, -0.4646}, -- NodeBox27
{0.0625, -0.3125, -0.5, 0.125, -0.25, -0.4646}, -- NodeBox28
{-0.0625, -0.375, -0.5, 0.0625, -0.3125, -0.4646}, -- NodeBox29
{-0.0625, -0.3125, -0.5, -0.125, -0.25, -0.4646}, -- NodeBox30
{-0.1875, -0.25, -0.5, -0.125, -0.125, -0.4646}, -- NodeBox31
{-0.125, -0.125, -0.5, -0.0625, -0.0625, -0.4646}, -- NodeBox32
{-0.016598, -0.3125, -0.48, 0.020747, -0.0625, -0.49}, -- NodeBox33
{-0.125, -0.209544, -0.48, 0.125, -0.172199, -0.49}, -- NodeBox34
{-0.0165975, -0.200, -0.477178, 0.020747, -0.175349, -0.435685}, -- NodeBox35
{0.1, -0.75, -0.125, 0.125, -0.5, 0.125}, -- NodeBox36
{-0.125, -0.75, -0.125, -0.1, -0.5, 0.125}, -- NodeBox37
{-0.125, -0.75, -0.125, 0.125, -0.729253, 0.125}, -- NodeBox38
{-0.125, -0.75, -0.125, 0.125, -0.5, -0.1}, -- NodeBox39
{-0.125, -0.75, 0.1, 0.125, -0.5, 0.125}, -- NodeBox40
{-0.0165975,-0.465, -0.125, 0.0165974, -0.451245, 0.125}, -- NodeBox41
{-0.0165975, -0.51, 0.112033, 0.0165974, -0.46, 0.125}, -- NodeBox42
{-0.0165975, -0.51, -0.125, 0.0165974, -0.46, -0.112033}, -- NodeBox43
}
},
selection_box = homedecor.nodebox.null,
})
homedecor.register("coatrack_wallmount", { homedecor.register("coatrack_wallmount", {
tiles = { "forniture_wood.png" }, tiles = { "forniture_wood.png" },
inventory_image = "homedecor_coatrack_wallmount_inv.png", inventory_image = "homedecor_coatrack_wallmount_inv.png",
@ -924,84 +757,6 @@ homedecor.register("skateboard", {
on_place = minetest.rotate_node on_place = minetest.rotate_node
}) })
homedecor.register("stonepath", {
description = "Garden stone path",
tiles = {
"default_stone.png"
},
inventory_image = "homedecor_stonepath_inv.png",
groups = { snappy=3 },
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, 0.3125, -0.3125, -0.48, 0.4375}, -- NodeBox1
{-0.25, -0.5, 0.125, 0, -0.48, 0.375}, -- NodeBox2
{0.125, -0.5, 0.125, 0.4375, -0.48, 0.4375}, -- NodeBox3
{-0.4375, -0.5, -0.125, -0.25, -0.48, 0.0625}, -- NodeBox4
{-0.0625, -0.5, -0.25, 0.25, -0.48, 0.0625}, -- NodeBox5
{0.3125, -0.5, -0.25, 0.4375, -0.48, -0.125}, -- NodeBox6
{-0.3125, -0.5, -0.375, -0.125, -0.48, -0.1875}, -- NodeBox7
{0.125, -0.5, -0.4375, 0.25, -0.48, -0.3125}, -- NodeBox8
}
},
selection_box = {
type = "fixed",
fixed = { -0.4375, -0.5, -0.4375, 0.4375, -0.4, 0.4375 }
}
})
homedecor.register("barbecue", {
description = "Barbecue",
tiles = {
{name="homedecor_barbecue_top.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=2}},
"forniture_black_metal.png",
},
groups = { snappy=3 },
light_source = 9,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.25, -0.4375, 0.0625, 0.3125}, -- NodeBox1
{0.4375, -0.5, 0.25, 0.5, 0.0625, 0.3125}, -- NodeBox2
{-0.5, -0.5, -0.3125, -0.4375, 0.0625, -0.25}, -- NodeBox3
{0.4375, -0.5, -0.3125, 0.5, 0.0625, -0.25}, -- NodeBox4
{-0.5, 0.0625, -0.3125, 0.5, 0.375, 0.3125}, -- NodeBox5
{-0.375, 0.5, -0.25, -0.313, 0.5, 0.251}, -- NodeBox6
{-0.25, 0.5, -0.25, -0.188, 0.5, 0.251}, -- NodeBox7
{-0.125, 0.5, -0.25, -0.063, 0.5, 0.251}, -- NodeBox8
{0, 0.5, -0.25, 0.062, 0.5, 0.251}, -- NodeBox9
{0.125, 0.5, -0.25, 0.187, 0.5, 0.251}, -- NodeBox10
{0.25, 0.5, -0.25, 0.312, 0.5, 0.251}, -- NodeBox11
{0.375, 0.5, -0.25, 0.437, 0.5, 0.251}, -- NodeBox12
{-0.5, 0.375, 0.251, 0.5, 0.5, 0.3125}, -- NodeBox13
{-0.5, 0.0625, -0.3125, 0.5, 0.5, -0.25}, -- NodeBox14
{-0.5, 0.0625, -0.3125, -0.438, 0.5, 0.3125}, -- NodeBox15
{0.4375, 0.0625, -0.3125, 0.5, 0.5, 0.3125}, -- NodeBox16
}
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.3125, 0.5, 0.625, 0.3125 }
},
expand = { top="homedecor:barbecue_meat" },
})
homedecor.register("barbecue_meat", {
tiles = {
"homedecor_barbecue_meat.png",
},
groups = { snappy=3, not_in_creative_inventory=1 },
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.125, -0.0625, -0.4375, 0.125}, -- NodeBox1
{0.125, -0.5, -0.125, 0.3125, -0.4375, 0.125}, -- NodeBox2
}
},
selection_box = homedecor.nodebox.null
})
homedecor.register("beer_tap", { homedecor.register("beer_tap", {
description = "Beer tap", description = "Beer tap",
tiles = { tiles = {
@ -1126,243 +881,6 @@ homedecor.register("tool_cabinet_top", {
selection_box = homedecor.nodebox.null selection_box = homedecor.nodebox.null
}) })
homedecor.register("swing", {
description = "Tree's swing",
tiles = {
"homedecor_swing_top.png",
"homedecor_swing_top.png^[transformR180",
"homedecor_swing_top.png"
},
inventory_image = "homedecor_swing_inv.png",
groups = { snappy=3, oddly_breakable_by_hand=3 },
node_box = {
type = "fixed",
fixed = {
{-0.3125, 0.33, -0.125, 0.3125, 0.376, 0.1875}, -- NodeBox1
{-0.3125, 0.376, 0.025, -0.3, 0.5, 0.0375}, -- NodeBox2
{ 0.3, 0.376, 0.025, 0.3125, 0.5, 0.0375}, -- NodeBox3
}
},
selection_box = {
type = "fixed",
fixed = { -0.3125, 0.33, -0.125, 0.3125, 0.5, 0.1875 }
},
on_place = function(itemstack, placer, pointed_thing)
isceiling, pos = homedecor.find_ceiling(itemstack, placer, pointed_thing)
if isceiling then
local height = 0
for i = 0, 4 do -- search up to 5 spaces downward from the ceiling for the first non-buildable-to node...
height = i
local testpos = { x=pos.x, y=pos.y-i-1, z=pos.z }
local testnode = minetest.get_node(testpos)
local testreg = core.registered_nodes[testnode.name]
if not testreg.buildable_to then
if i < 1 then
minetest.chat_send_player(placer:get_player_name(), "No room under there to hang a swing.")
return
else
break
end
end
end
for j = 0, height do -- then fill that space with ropes...
local testpos = { x=pos.x, y=pos.y-j, z=pos.z }
local testnode = minetest.get_node(testpos)
local testreg = core.registered_nodes[testnode.name]
minetest.set_node(testpos, { name = "homedecor:swing_rope", param2 = fdir })
end
minetest.set_node({ x=pos.x, y=pos.y-height, z=pos.z }, { name = "homedecor:swing", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
else
minetest.chat_send_player(placer:get_player_name(), "You have to point at the bottom side of an overhanging object to place a swing.")
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
for i = 0, 4 do
local testpos = { x=pos.x, y=pos.y+i+1, z=pos.z }
if minetest.get_node(testpos).name == "homedecor:swing_rope" then
minetest.remove_node(testpos)
else
return
end
end
end
})
homedecor.register("swing_rope", {
tiles = {
"homedecor_swingrope_sides.png"
},
groups = { not_in_creative_inventory=1 },
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, 0.025, -0.3, 0.5, 0.0375}, -- NodeBox1
{0.3, -0.5, 0.025, 0.3125, 0.5, 0.0375}, -- NodeBox2
}
},
selection_box = homedecor.nodebox.null
})
local bookcolors = {
"red",
"green",
"blue",
"violet",
"grey",
"brown"
}
local BOOK_FORMNAME = "homedecor:book_form"
for c in ipairs(bookcolors) do
local color = bookcolors[c]
local color_d = S(bookcolors[c])
local function book_dig(pos, node, digger)
if minetest.is_protected(pos, digger:get_player_name()) then return end
local meta = minetest.get_meta(pos)
local stack = ItemStack({
name = "homedecor:book_"..color,
metadata = meta:get_string("text"),
})
stack = digger:get_inventory():add_item("main", stack)
if not stack:is_empty() then
minetest.item_drop(stack, digger, pos)
end
minetest.remove_node(pos)
end
homedecor.register("book_"..color, {
description = S("Book (%s)"):format(color_d),
mesh = "homedecor_book.obj",
tiles = { "homedecor_book_"..color..".png" },
inventory_image = "homedecor_book_"..color.."_inv.png",
wield_image = "homedecor_book_"..color.."_inv.png",
groups = { snappy=3, oddly_breakable_by_hand=3, book=1 },
stack_max = 1,
on_rightclick = function(pos, node, clicker)
local fdir = node.param2
minetest.swap_node(pos, { name = "homedecor:book_open_"..color, param2 = fdir })
end,
on_place = function(itemstack, placer, pointed_thing)
local plname = placer:get_player_name()
local pos = pointed_thing.under
local node = minetest.get_node(pos)
local n = minetest.registered_nodes[node.name]
if not n.buildable_to then
pos = pointed_thing.above
node = minetest.get_node(pos)
n = minetest.registered_nodes[node.name]
if not n.buildable_to then return end
end
if minetest.is_protected(pos, plname) then return end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.set_node(pos, {
name = "homedecor:book_"..color,
param2 = fdir,
})
local text = itemstack:get_metadata() or ""
local meta = minetest.get_meta(pos)
meta:set_string("text", text)
local data = minetest.deserialize(text) or {}
if data.title and data.title ~= "" then
meta:set_string("infotext", data.title)
end
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
on_dig = book_dig,
on_use = function(itemstack, user, pointed_thing)
local player_name = user:get_player_name()
local data = minetest.deserialize(itemstack:get_metadata())
local title, text, owner = "", "", player_name
if data then
title, text, owner = data.title, data.text, data.owner
end
local formspec
if owner == player_name then
formspec = "size[8,8]"..default.gui_bg..default.gui_bg_img..
"field[0.5,1;7.5,0;title;Book title :;"..
minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;text;Book content :;"..
minetest.formspec_escape(text).."]"..
"button_exit[2.5,7.5;3,1;save;Save]"
else
formspec = "size[8,8]"..default.gui_bg..
"button_exit[7,0.25;1,0.5;close;X]"..
default.gui_bg_img..
"label[0.5,0.5;by "..owner.."]"..
"label[0.5,0;"..minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]"
end
minetest.show_formspec(user:get_player_name(), BOOK_FORMNAME, formspec)
end,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.25, 0.2, -0.35, 0.25}
},
collision_box = {
type = "fixed",
fixed = {-0.15, -0.5, -0.25, 0.15, -0.35, 0.25}
},
})
homedecor.register("book_open_"..color, {
mesh = "homedecor_book_open.obj",
tiles = { "homedecor_book_open_"..color..".png" },
groups = { snappy=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1 },
drop = "homedecor:book_"..color,
on_dig = book_dig,
on_rightclick = function(pos, node, clicker)
local fdir = node.param2
minetest.swap_node(pos, { name = "homedecor:book_"..color, param2 = fdir })
minetest.sound_play("homedecor_book_close", {
pos=pos,
max_hear_distance = 3,
gain = 2,
})
end,
selection_box = {
type = "fixed",
fixed = {-0.35, -0.5, -0.25, 0.35, -0.4, 0.25}
},
collision_box = {
type = "fixed",
fixed = {-0.35, -0.5, -0.25, 0.35, -0.4, 0.25}
},
})
end
minetest.register_on_player_receive_fields(function(player, form_name, fields)
if form_name ~= BOOK_FORMNAME or not fields.save then
return
end
local stack = player:get_wielded_item()
if minetest.get_item_group(stack:get_name(), "book") == 0 then
return
end
local data = minetest.deserialize(stack:get_metadata()) or {}
data.title, data.text, data.owner =
fields.title, fields.text, player:get_player_name()
stack:set_metadata(minetest.serialize(data))
player:set_wielded_item(stack)
minetest.log("action", player:get_player_name().." has written in a book (title: \""..fields.title.."\"): \""..fields.text..
"\" at location: "..minetest.pos_to_string(player:getpos()))
end)
homedecor.register("calendar", { homedecor.register("calendar", {
description = "Calendar", description = "Calendar",
drawtype = "signlike", drawtype = "signlike",