Enable luacheck

This commit is contained in:
Niklp 2023-12-10 14:08:23 +01:00 committed by SmallJoker
parent 1f9875fced
commit f1fdabe0b0
7 changed files with 29 additions and 24 deletions

10
.github/workflows/luacheck.yml vendored Normal file
View File

@ -0,0 +1,10 @@
name: luacheck
on: [push, pull_request]
jobs:
luacheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Luacheck
uses: lunarmodules/luacheck@master

View File

@ -1,20 +1,16 @@
unused_args = false unused_args = false
allow_defined_top = true max_line_length = 140
read_globals = { read_globals = {
"doors", "minetest",
"DIR_DELIM", "vector",
"minetest", "core",
"dump",
"vector", "nodeupdate",
"VoxelManip", "VoxelArea",
"PseudoRandom", "ItemStack",
"intllib",
"default", "default",
"armor", "doors",
"stairs",
"stairsplus",
"mesecon",
} }
globals = { globals = {
core = { fields = { "do_item_eat" }}, "mydoors"
} }

View File

@ -7,7 +7,7 @@ local door_wood = { -- color, desc, image
{"yellow", "Clear Stained", "yellow"}, {"yellow", "Clear Stained", "yellow"},
{"black", "Black", "black"}, {"black", "Black", "black"},
} }
local function my_door_wood_block_stairs(nodename, def) local function my_door_wood_block_stairs(nodename, def)
local mod = string.match(nodename, "(.+):") local mod = string.match(nodename, "(.+):")
local name = string.match(nodename, ":(.+)") local name = string.match(nodename, ":(.+)")
minetest.register_node(nodename, def) minetest.register_node(nodename, def)
@ -23,22 +23,21 @@ local function my_door_wood_block_stairs(nodename, def)
sounds = def.sounds, sounds = def.sounds,
} }
) )
elseif minetest.get_modpath("stairs") then elseif minetest.get_modpath("stairs") then
stairs.register_stair_and_slab(name,nodename, stairs.register_stair_and_slab(name,nodename,
def.groups, def.groups,
def.tiles, def.tiles,
("%s Stair"):format(def.description), ("%s Stair"):format(def.description),
("%s Slab"):format(def.description), ("%s Slab"):format(def.description),
def.sounds def.sounds
) )
end end
end end
local function add_door(color, desc, img) local function add_door(color, desc, img)
my_door_wood_block_stairs("my_door_wood:wood_"..color, { my_door_wood_block_stairs("my_door_wood:wood_"..color, {
description = desc.." Wood", description = desc.." Wood",
drawtype = "normal", drawtype = "normal",
paramtype = "light",
tiles = {"mydoors_"..img.."_wood.png"}, tiles = {"mydoors_"..img.."_wood.png"},
paramtype = "light", paramtype = "light",
groups = {cracky = 2, choppy = 2, wood = 1}, groups = {cracky = 2, choppy = 2, wood = 1},

View File

@ -40,7 +40,7 @@ local function add_door(col)
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0}) local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if not placer or not placer:is_player() then if not placer or not placer:is_player() then
return return
end end

View File

@ -33,7 +33,7 @@ local function add_door(doora, doorb, doorc, doord, num, des, recipe)
local function onplace(itemstack, placer, pointed_thing) local function onplace(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0}) local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if not placer or not placer:is_player() then if not placer or not placer:is_player() then
return return
end end

View File

@ -34,7 +34,7 @@ minetest.register_node("my_garage_door:garage_door", {
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0}) local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if not placer or not placer:is_player() then if not placer or not placer:is_player() then
return return
end end
@ -75,7 +75,7 @@ minetest.register_node("my_garage_door:garage_door", {
local t1 = vector.add(above, dir) local t1 = vector.add(above, dir)
local t2 = vector.add(t1, dir) local t2 = vector.add(t1, dir)
if not player or not player:is_player() then if not player or not player:is_player() then
return return
end end
@ -153,7 +153,7 @@ minetest.register_node("my_garage_door:garage_door_open", {
local t1 = vector.add(pos, dir) local t1 = vector.add(pos, dir)
local t2 = vector.subtract(t1, {x=0,y=1,z=0}) local t2 = vector.subtract(t1, {x=0,y=1,z=0})
if not player or not player:is_player() then if not player or not player:is_player() then
return return
end end

View File

@ -41,7 +41,7 @@ local function add_door(col, des, tint, craft)
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0}) local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if not placer or not placer:is_player() then if not placer or not placer:is_player() then
return return
end end