use wallmounted-only rotation for default and locked signs.

includes code by nore to handle the actual rotation restriction
This commit is contained in:
Vanessa Ezekowitz 2015-05-14 13:13:27 -04:00
parent e374b83bc0
commit f1db5635f5
2 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,3 @@
default default
intllib? intllib?
screwdriver?

View File

@ -12,6 +12,20 @@
signs_lib = {} signs_lib = {}
local screwdriver = screwdriver or {}
signs_lib.wallmounted_rotate = function(pos, node, user, mode, new_param2)
if mode ~= screwdriver.ROTATE_AXIS then return false end
minetest.swap_node(pos, {name = node.name, param2 = (node.param2 + 1) % 6})
for _, v in ipairs(minetest.get_objects_inside_radius(pos, 0.5)) do
local e = v:get_luaentity()
if e and e.name == "signs:text" then
v:remove()
end
end
signs_lib.update_sign(pos)
return true
end
signs_lib.modpath = minetest.get_modpath("signs_lib") signs_lib.modpath = minetest.get_modpath("signs_lib")
signs_lib.regular_wall_sign_model = { signs_lib.regular_wall_sign_model = {
@ -697,6 +711,7 @@ minetest.register_node(":default:sign_wall", {
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
signs_lib.update_sign(pos) signs_lib.update_sign(pos)
end, end,
on_rotate = signs_lib.wallmounted_rotate
}) })
minetest.register_node(":signs:sign_yard", { minetest.register_node(":signs:sign_yard", {
@ -831,6 +846,7 @@ minetest.register_node(":locked_sign:sign_wall_locked", {
return pname == owner or pname == minetest.setting_get("name") return pname == owner or pname == minetest.setting_get("name")
or minetest.check_player_privs(pname, {sign_editor=true}) or minetest.check_player_privs(pname, {sign_editor=true})
end, end,
on_rotate = signs_lib.wallmounted_rotate
}) })
-- metal, colored signs -- metal, colored signs