1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-07-03 16:40:45 +02:00

luacheck, remove old compatibility stuff

This commit is contained in:
Niklp09
2023-06-11 20:13:08 +02:00
parent 72a9d1bb7d
commit 1f31515cdd
17 changed files with 71 additions and 96 deletions

View File

@ -89,7 +89,6 @@ end
function signs_api.on_place_direction(itemstack, placer, pointed_thing)
local name = itemstack:get_name()
local ndef = minetest.registered_nodes[name]
local restriction = display_api.is_rotation_restricted()
local bdir = {
x = pointed_thing.under.x - pointed_thing.above.x,
@ -101,24 +100,14 @@ function signs_api.on_place_direction(itemstack, placer, pointed_thing)
local ndir, test
if ndef and ndef.paramtype2 == "facedir" then
-- If legacy mode, only accept upright nodes
if restriction and bdir.x == 0 and bdir.z == 0 then
-- Ceiling or floor pointed (facedir chosen from player dir)
ndir = minetest.dir_to_facedir({x=pdir.x, y=0, z=pdir.z})
else
-- Wall pointed or no rotation restriction
ndir = minetest.dir_to_facedir(bdir, not restriction)
end
-- Wall pointed
ndir = minetest.dir_to_facedir(bdir, true)
test = { [0]=-pdir.x, pdir.z, pdir.x, -pdir.z, -pdir.x, [8]=pdir.x }
end
if ndef and ndef.paramtype2 == "wallmounted" then
ndir = minetest.dir_to_wallmounted(bdir)
-- If legacy mode, only accept upright nodes
if restriction and (ndir == 0 or ndir == 1) then
ndir = minetest.dir_to_wallmounted({x=pdir.x, y=0, z=pdir.z})
end
test = { [0]=-pdir.x, -pdir.x, pdir.z, -pdir.z, -pdir.x, pdir.x}
end
@ -141,7 +130,6 @@ function signs_api.on_place_direction(itemstack, placer, pointed_thing)
end
-- Handles screwdriver rotation
-- (see "if" block below for rotation restriction mode).
signs_api.on_rotate = function(pos, node, player, mode, new_param2)
-- If rotation mode is 1 and sign is directional, swap direction between
-- each rotation.
@ -165,25 +153,6 @@ signs_api.on_rotate = function(pos, node, player, mode, new_param2)
return display_api.on_rotate(pos, node, player, mode, new_param2)
end
-- Legacy mode with rotation restriction
-- TODO:When MT < 5.0 no more in use, to be removed
if display_api.is_rotation_restricted() then
signs_api.on_rotate = function(pos, node, player, mode, new_param2)
-- If rotation mode is 2 and sign is directional, swap direction.
-- Otherwise use display_api's on_rotate function.
if mode == 2 then
local ndef = minetest.registered_nodes[node.name]
if ndef and ndef.signs_other_dir then
minetest.swap_node(pos, {name = ndef.signs_other_dir,
param1 = node.param1, param2 = node.param2})
display_api.update_entities(pos)
return true
end
end
return display_api.on_rotate(pos, node, player, mode, new_param2)
end
end
function signs_api.register_sign(mod, name, model)
-- Default fields
local fields = {