Improve on_rotate functions (#21)

Fixed bugs and improve on_rotate and support color- paramtype2s
This commit is contained in:
12Me21 2018-09-26 13:41:30 -04:00 committed by Pierre-Yves Rollo
parent 2f1899a35d
commit 8fa161c90b

@ -132,18 +132,19 @@ function signs_api.on_place_direction(itemstack, placer, pointed_thing)
end end
-- Handles screwdriver rotation. Direction is affected for direction signs -- Handles screwdriver rotation. Direction is affected for direction signs
-- If rotation mode is 2 and sign is directional, swap direction.
-- Otherwise use display_api's on_rotate function.
function signs_api.on_rotate(pos, node, player, mode, new_param2) function signs_api.on_rotate(pos, node, player, mode, new_param2)
if mode == 2 then if mode == 2 then
local ndef = minetest.registered_nodes[node.name] local ndef = minetest.registered_nodes[node.name]
if ndef.signs_other_dir then if ndef.signs_other_dir then
minetest.swap_node(pos, {name = ndef.signs_other_dir, minetest.swap_node(pos, {name = ndef.signs_other_dir,
param1 = node.param1, param2 = node.param2}) param1 = node.param1, param2 = node.param2})
display_api.update_entities(pos) display_api.update_entities(pos)
end return true
else end
display_api.on_rotate(pos, node, user, mode, new_param2)
end end
return false; return display_api.on_rotate(pos, node, user, mode, new_param2)
end end
function signs_api.register_sign(mod, name, model) function signs_api.register_sign(mod, name, model)