From f1db5635f54a27072cd5270d0610e8f89d6916f7 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Thu, 14 May 2015 13:13:27 -0400 Subject: [PATCH] use wallmounted-only rotation for default and locked signs. includes code by nore to handle the actual rotation restriction --- signs_lib/depends.txt | 2 +- signs_lib/init.lua | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/signs_lib/depends.txt b/signs_lib/depends.txt index c48fe0d0..c0dd3b07 100644 --- a/signs_lib/depends.txt +++ b/signs_lib/depends.txt @@ -1,3 +1,3 @@ default intllib? - +screwdriver? diff --git a/signs_lib/init.lua b/signs_lib/init.lua index 29d4784e..9bf36e23 100644 --- a/signs_lib/init.lua +++ b/signs_lib/init.lua @@ -12,6 +12,20 @@ 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.regular_wall_sign_model = { @@ -697,6 +711,7 @@ minetest.register_node(":default:sign_wall", { on_punch = function(pos, node, puncher) signs_lib.update_sign(pos) end, + on_rotate = signs_lib.wallmounted_rotate }) 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") or minetest.check_player_privs(pname, {sign_editor=true}) end, + on_rotate = signs_lib.wallmounted_rotate }) -- metal, colored signs