Fix quarry rotation (#68)

Previously the model was rotated but the dig position of the quarry was
not updated. If the player did not restart the quarry through the
formspec, it dug at the previous location.
This commit is contained in:
Alexander Ried
2020-07-06 04:59:21 +02:00
committed by GitHub
parent 4522961140
commit 35e989ba2e

View File

@ -281,6 +281,20 @@ minetest.register_node("technic:quarry", {
reset_quarry(pos) reset_quarry(pos)
set_quarry_status(pos) set_quarry_status(pos)
end, end,
on_rotate = function(pos, node, player, click, new_param2)
local meta = minetest.get_meta(pos)
if meta:get_int("enabled") == 1 then
return false
end
-- only allow rotation around y-axis
node.param2 = new_param2 % 4
minetest.swap_node(pos, node)
reset_quarry(pos)
set_quarry_status(pos)
return true
end,
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
minetest.get_meta(pos):set_string("owner", placer:get_player_name()) minetest.get_meta(pos):set_string("owner", placer:get_player_name())
pipeworks.scan_for_tube_objects(pos) pipeworks.scan_for_tube_objects(pos)