Added a deckchair

This commit is contained in:
kilbith 2014-08-27 14:24:50 +02:00 committed by Vanessa Ezekowitz
parent 7da4ec0e63
commit f330d19d03
9 changed files with 121 additions and 0 deletions

View File

@ -2627,4 +2627,14 @@ minetest.register_craft({
}, },
}) })
minetest.register_craft({
output = "homedecor:deckchair_foot",
recipe = {
{ "group:stick", "building_blocks:terrycloth_towel", "group:stick" },
{ "group:stick", "building_blocks:terrycloth_towel", "group:stick" },
{ "group:stick", "building_blocks:terrycloth_towel", "group:stick" }
},
})

View File

@ -748,6 +748,117 @@ minetest.register_node("homedecor:bench_large_2_right", {
}, },
}) })
local fdir_to_fwd = {
{ 0, 1 },
{ 1, 0 },
{ 0, -1 },
{ -1, 0 },
}
minetest.register_node("homedecor:deckchair_head", {
tiles = {
"homedecor_deckchair_top_c1.png",
"homedecor_deckchair_bottom.png",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_sides.png^[transformFX",
"homedecor_deckchair_back.png",
"homedecor_deckchair_front.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
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 = {
type = "fixed",
fixed = { 0, 0, 0, 0, 0, 0 }
}
})
minetest.register_node("homedecor:deckchair_foot", {
tiles = {
"homedecor_deckchair_top_c2.png",
"homedecor_deckchair_bottom.png",
"homedecor_deckchair_sides.png",
"homedecor_deckchair_sides.png^[transformFX",
"homedecor_deckchair_front.png"
},
inventory_image = "homedecor_deckchair_inv.png",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
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 }
},
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x + fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + fdir_to_fwd[fdir+1][2] }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = "homedecor:deckchair_foot", param2 = fdir })
minetest.add_node(pos2, { name = "homedecor:deckchair_head", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local fdir = oldnode.param2
if not fdir or fdir > 3 then return end
local pos2 = { x = pos.x + fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + fdir_to_fwd[fdir+1][2] }
if minetest.get_node(pos2).name == "homedecor:deckchair_head" then
minetest.remove_node(pos2)
end
end
})
-- Aliases for 3dforniture mod. -- Aliases for 3dforniture mod.
minetest.register_alias("3dforniture:table", "homedecor:table") minetest.register_alias("3dforniture:table", "homedecor:table")

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B