1
0
mirror of https://github.com/mt-mods/signs_lib.git synced 2024-11-05 09:30:19 +01:00

Fix broken/bad screwdriver rotation handling

This commit is contained in:
Vanessa Dannenberg 2019-09-11 15:54:50 -04:00
parent eba3ce1308
commit 4614d66cbe
2 changed files with 16 additions and 5 deletions

17
api.lua
View File

@ -66,7 +66,11 @@ signs_lib.wall_fdir_to_back = {
local ctexcache = {}
signs_lib.wallmounted_rotate = function(pos, node, user, mode)
if mode ~= screwdriver.ROTATE_FACE then return false end
if not signs_lib.can_modify(pos, user) then return false end
if mode ~= screwdriver.ROTATE_FACE or string.match(node.name, "_onpole") then
return false
end
minetest.swap_node(pos, { name = node.name, param2 = wall_dir_change[node.param2 % 6] })
for _, v in ipairs(minetest.get_objects_inside_radius(pos, 0.5)) do
local e = v:get_luaentity()
@ -79,8 +83,15 @@ signs_lib.wallmounted_rotate = function(pos, node, user, mode)
end
signs_lib.facedir_rotate = function(pos, node, user, mode)
if mode ~= screwdriver.ROTATE_FACE or not signs_lib.can_modify(pos, user) then return end
newparam2 = ((node.param2 % 6 ) == 0) and 1 or 0
if not signs_lib.can_modify(pos, user) then return false end
if mode ~= screwdriver.ROTATE_FACE or string.match(node.name, "_onpole") then
return false
end
local newparam2 = node.param2 + 1
if newparam2 > 3 then newparam2 = 0 end
minetest.swap_node(pos, { name = node.name, param2 = newparam2 })
for _, v in ipairs(minetest.get_objects_inside_radius(pos, 0.5)) do
local e = v:get_luaentity()

View File

@ -41,7 +41,7 @@ for _, onpole in ipairs({"", "_onpole"}) do
on_destruct = signs_lib.destruct_sign,
on_receive_fields = signs_lib.receive_fields,
on_punch = signs_lib.update_sign,
on_rotate = on_rotate,
on_rotate = signs_lib.wallmounted_rotate,
number_of_lines = signs_lib.standard_lines,
horiz_scaling = signs_lib.standard_hscale,
vert_scaling = signs_lib.standard_vscale,
@ -84,7 +84,7 @@ for _, onpole in ipairs({"", "_onpole"}) do
on_receive_fields = signs_lib.receive_fields,
on_punch = signs_lib.update_sign,
can_dig = signs_lib.can_modify,
on_rotate = on_rotate,
on_rotate = signs_lib.wallmounted_rotate,
number_of_lines = signs_lib.standard_lines,
horiz_scaling = signs_lib.standard_hscale,
vert_scaling = signs_lib.standard_vscale,