From 1196c17b31696887b8e9190fe6b0ca636fc96d71 Mon Sep 17 00:00:00 2001 From: kilbith Date: Thu, 18 Sep 2014 10:38:35 +0200 Subject: [PATCH] Add tree's swing (2 nodes) Add tree's swing (2 nodes) : https://cdn.mediacru.sh/k3rWXDs4HFsh.png Textures : http://mamadou3.free.fr/swing_textures.zip --- homedecor/misc-nodes.lua | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/homedecor/misc-nodes.lua b/homedecor/misc-nodes.lua index 30bcbf54..506b5a21 100644 --- a/homedecor/misc-nodes.lua +++ b/homedecor/misc-nodes.lua @@ -1781,3 +1781,50 @@ minetest.register_node("homedecor:tool_cabinet_top", { } }) +minetest.register_node("homedecor:swing", { + description = "Tree's swing", + tiles = { + "homedecor_swing_top.png", + "homedecor_swing_bottom.png", + "homedecor_swing_sides.png" + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + 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 + } + }, + on_place = function(itemstack, placer, pointed_thing) + return homedecor.stack_vertically(itemstack, placer, pointed_thing, + "homedecor:swing", "homedecor:swing_rope") + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z } + if minetest.get_node(pos2).name == "homedecor:swing_rope" then + minetest.remove_node(pos2) + end + end +}) + +minetest.register_node("homedecor:swing_rope", { + tiles = { + "homedecor_swingrope_sides.png" + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = { snappy=3, 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 + } + } +})