forked from mtcontrib/signs_lib
Fix broken/bad screwdriver rotation handling
This commit is contained in:
parent
eba3ce1308
commit
4614d66cbe
17
api.lua
17
api.lua
@ -66,7 +66,11 @@ signs_lib.wall_fdir_to_back = {
|
|||||||
local ctexcache = {}
|
local ctexcache = {}
|
||||||
|
|
||||||
signs_lib.wallmounted_rotate = function(pos, node, user, mode)
|
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] })
|
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
|
for _, v in ipairs(minetest.get_objects_inside_radius(pos, 0.5)) do
|
||||||
local e = v:get_luaentity()
|
local e = v:get_luaentity()
|
||||||
@ -79,8 +83,15 @@ signs_lib.wallmounted_rotate = function(pos, node, user, mode)
|
|||||||
end
|
end
|
||||||
|
|
||||||
signs_lib.facedir_rotate = function(pos, node, user, mode)
|
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
|
if not signs_lib.can_modify(pos, user) then return false end
|
||||||
newparam2 = ((node.param2 % 6 ) == 0) and 1 or 0
|
|
||||||
|
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 })
|
minetest.swap_node(pos, { name = node.name, param2 = newparam2 })
|
||||||
for _, v in ipairs(minetest.get_objects_inside_radius(pos, 0.5)) do
|
for _, v in ipairs(minetest.get_objects_inside_radius(pos, 0.5)) do
|
||||||
local e = v:get_luaentity()
|
local e = v:get_luaentity()
|
||||||
|
@ -41,7 +41,7 @@ for _, onpole in ipairs({"", "_onpole"}) do
|
|||||||
on_destruct = signs_lib.destruct_sign,
|
on_destruct = signs_lib.destruct_sign,
|
||||||
on_receive_fields = signs_lib.receive_fields,
|
on_receive_fields = signs_lib.receive_fields,
|
||||||
on_punch = signs_lib.update_sign,
|
on_punch = signs_lib.update_sign,
|
||||||
on_rotate = on_rotate,
|
on_rotate = signs_lib.wallmounted_rotate,
|
||||||
number_of_lines = signs_lib.standard_lines,
|
number_of_lines = signs_lib.standard_lines,
|
||||||
horiz_scaling = signs_lib.standard_hscale,
|
horiz_scaling = signs_lib.standard_hscale,
|
||||||
vert_scaling = signs_lib.standard_vscale,
|
vert_scaling = signs_lib.standard_vscale,
|
||||||
@ -84,7 +84,7 @@ for _, onpole in ipairs({"", "_onpole"}) do
|
|||||||
on_receive_fields = signs_lib.receive_fields,
|
on_receive_fields = signs_lib.receive_fields,
|
||||||
on_punch = signs_lib.update_sign,
|
on_punch = signs_lib.update_sign,
|
||||||
can_dig = signs_lib.can_modify,
|
can_dig = signs_lib.can_modify,
|
||||||
on_rotate = on_rotate,
|
on_rotate = signs_lib.wallmounted_rotate,
|
||||||
number_of_lines = signs_lib.standard_lines,
|
number_of_lines = signs_lib.standard_lines,
|
||||||
horiz_scaling = signs_lib.standard_hscale,
|
horiz_scaling = signs_lib.standard_hscale,
|
||||||
vert_scaling = signs_lib.standard_vscale,
|
vert_scaling = signs_lib.standard_vscale,
|
||||||
|
Loading…
Reference in New Issue
Block a user