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

@ -5,6 +5,7 @@
minetest.register_node("mesecons_stickyblocks_flat:sticky_block_xz", {
description = "Flat Sticky Block",
drawtype = "nodebox",
paramtype2 = "facedir",
tiles = {
"mesecons_stickyblocks_flat.png",
"mesecons_stickyblocks_flat.png",
@ -38,12 +39,17 @@ minetest.register_node("mesecons_stickyblocks_flat:sticky_block_xz", {
minetest.swap_node(pos, {name = "mesecons_stickyblocks_flat:sticky_block_xy" })
end
end,
on_rotate = function(pos, node, player, pointed_thing)
minetest.swap_node(pos, {name = "mesecons_stickyblocks_flat:sticky_block_xy" })
return true
end,
})
-- Flat sticky block not Z
minetest.register_node("mesecons_stickyblocks_flat:sticky_block_xy", {
description = "Flat XY Sticky Block",
drawtype = "nodebox",
paramtype2 = "facedir",
drop = "mesecons_stickyblocks_flat:sticky_block_xz",
tiles = { --+Y, -Y, +X, -X, +Z, -Z
"mesecons_stickyblocks_flat_sticky.png",
@ -78,12 +84,17 @@ minetest.register_node("mesecons_stickyblocks_flat:sticky_block_xy", {
minetest.swap_node(pos, {name = "mesecons_stickyblocks_flat:sticky_block_yz" })
end
end,
on_rotate = function(pos, node, player, pointed_thing)
minetest.swap_node(pos, {name = "mesecons_stickyblocks_flat:sticky_block_yz" })
return true
end,
})
-- Flat sticky block not X
minetest.register_node("mesecons_stickyblocks_flat:sticky_block_yz", {
description = "Flat YZ Sticky Block",
drawtype = "nodebox",
paramtype2 = "facedir",
drop = "mesecons_stickyblocks_flat:sticky_block_xz",
tiles = {
"mesecons_stickyblocks_flat_sticky.png",
@ -119,6 +130,10 @@ minetest.register_node("mesecons_stickyblocks_flat:sticky_block_yz", {
minetest.swap_node(pos, {name = "mesecons_stickyblocks_flat:sticky_block_xz" })
end
end,
on_rotate = function(pos, node, player, pointed_thing)
minetest.swap_node(pos, {name = "mesecons_stickyblocks_flat:sticky_block_xz" })
return true
end,
})

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 = {