summaryrefslogtreecommitdiff
path: root/node_defs.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-11-07 20:59:50 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-11-07 21:01:09 -0500
commit620a799fb47f06fef8e09e10f779fcf659fe1402 (patch)
tree910e79f208f39f3c0c8f5495fc2ee4d9bbf9e8f4 /node_defs.lua
parentc3e3f7ae38001fc0eeec8c20b65c4a3536998642 (diff)
Moretrees' trunks can now be turned sideways when placing,
using minetest.rotate_and_place() Requires Minetest git commit 1d856b73 or later.
Diffstat (limited to 'node_defs.lua')
-rw-r--r--node_defs.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/node_defs.lua b/node_defs.lua
index 897a3c7..a4f1346 100644
--- a/node_defs.lua
+++ b/node_defs.lua
@@ -40,6 +40,14 @@ for i in ipairs(moretrees.treelist) do
is_ground_content = true,
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
+ on_place = function(itemstack, placer, pointed_thing)
+ local keys=placer:get_player_control()
+ local pos = pointed_thing.under
+ if not moretrees:node_is_owned(pos, placer) then
+ minetest.rotate_and_place(itemstack, placer, pointed_thing,
+ moretrees.expect_infinite_stacks, { invert_wall = keys.sneak })
+ end
+ end
})
minetest.register_node("moretrees:"..treename.."_planks", {
@@ -378,6 +386,14 @@ minetest.register_node("moretrees:rubber_tree_trunk_empty", {
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
paramtype2 = "facedir",
+ on_place = function(itemstack, placer, pointed_thing)
+ local keys=placer:get_player_control()
+ local pos = pointed_thing.under
+ if not moretrees:node_is_owned(pos, placer) then
+ minetest.rotate_and_place(itemstack, placer, pointed_thing,
+ moretrees.expect_infinite_stacks, { invert_wall = keys.sneak })
+ end
+ end
})
minetest.register_abm({