Added on_rotate

It's possible to change axis with the screw driver. 
Note that It does not really use facedir but still use 3 pre-made orientations.  Paramtype2 facedir is required for some screw driver to trigger on_rotate but it's not really used for the rotation.
This commit is contained in:
Eric
2019-10-12 22:29:03 -04:00
parent b16f0a5bac
commit 2089931d5a
2 changed files with 30 additions and 0 deletions

View File

@ -6,6 +6,7 @@ minetest.register_node("mesecons_stickyblocks_linear:sticky_block_x", {
description = "X Sticky Block",
drawtype = "nodebox",
drop = "mesecons_stickyblocks_linear:sticky_block_y",
paramtype2 = "facedir",
tiles = {
"mesecons_stickyblocks_linear.png",
"mesecons_stickyblocks_linear.png",
@ -37,12 +38,17 @@ minetest.register_node("mesecons_stickyblocks_linear:sticky_block_x", {
minetest.swap_node(pos, {name = "mesecons_stickyblocks_linear:sticky_block_y" })
end
end,
on_rotate = function(pos, node, player, pointed_thing)
minetest.swap_node(pos, {name = "mesecons_stickyblocks_linear:sticky_block_y" })
return true
end,
})
-- Y sticky block
minetest.register_node("mesecons_stickyblocks_linear:sticky_block_y", {
description = "Linear Sticky Block",
drawtype = "nodebox",
paramtype2 = "facedir",
tiles = {
"mesecons_stickyblocks_linear_sticky.png",
"mesecons_stickyblocks_linear_sticky.png",
@ -74,12 +80,17 @@ minetest.register_node("mesecons_stickyblocks_linear:sticky_block_y", {
minetest.swap_node(pos, {name = "mesecons_stickyblocks_linear:sticky_block_z" })
end
end,
on_rotate = function(pos, node, player, pointed_thing)
minetest.swap_node(pos, {name = "mesecons_stickyblocks_linear:sticky_block_z" })
return true
end,
})
-- Z sticky block
minetest.register_node("mesecons_stickyblocks_linear:sticky_block_z", {
description = "Z Sticky Block",
drawtype = "nodebox",
paramtype2 = "facedir",
drop = "mesecons_stickyblocks_linear:sticky_block_y",
tiles = {
"mesecons_stickyblocks_linear.png",
@ -112,6 +123,10 @@ minetest.register_node("mesecons_stickyblocks_linear:sticky_block_z", {
minetest.swap_node(pos, {name = "mesecons_stickyblocks_linear:sticky_block_x" })
end
end,
on_rotate = function(pos, node, player, pointed_thing)
minetest.swap_node(pos, {name = "mesecons_stickyblocks_linear:sticky_block_x" })
return true
end,
})
mesecon.rules.y = {