add luacheck, add github actions luacheck, fix luacheck warnings

master
unknown 2022-08-21 21:39:25 -04:00
parent 32cdd65af9
commit 86ebe3a3bf
7 changed files with 63 additions and 14 deletions

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

@ -0,0 +1,18 @@
name: luacheck
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: apt
run: sudo apt-get install -y luarocks
- name: luacheck install
run: luarocks install --local luacheck
- name: luacheck run
run: $HOME/.luarocks/bin/luacheck ./

25
.luacheckrc Normal file
View File

@ -0,0 +1,25 @@
unused_args = false
allow_defined_top = true
exclude_files = {".luacheckrc"}
globals = {
"minetest", "core",
--mod provided
"abritorch",
}
read_globals = {
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
--luac
"math", "table",
-- Builtin
"vector", "ItemStack", "dump", "DIR_DELIM", "VoxelArea", "Settings", "PcgRandom", "VoxelManip", "PseudoRandom",
--mod produced
"default",
}

View File

@ -6,9 +6,9 @@ local modname
if minetest.get_modpath("caverealms") then
recipe_list = {
{"black", "spike",}, {"blue", "glow_crystal",},
{"cyan", "glow_gem",}, {"green", "glow_emerald",},
{"magenta", "salt_gem",}, {"orange", "fire_vine",},
{"purple", "glow_amethyst",}, {"red", "glow_ruby",},
{"cyan", "glow_gem",}, {"green", "glow_emerald",},
{"magenta", "salt_gem",}, {"orange", "fire_vine",},
{"purple", "glow_amethyst",}, {"red", "glow_ruby",},
{"yellow", "glow_mese",}, {"white", "glow_ore",},
}
modname = "caverealms"
@ -16,9 +16,9 @@ if minetest.get_modpath("caverealms") then
else
recipe_list = {
{"black", "black",}, {"blue", "blue",},
{"cyan", "cyan",}, {"green", "green",},
{"magenta", "magenta",}, {"orange", "orange",},
{"purple", "violet",}, {"red", "red",},
{"cyan", "cyan",}, {"green", "green",},
{"magenta", "magenta",}, {"orange", "orange",},
{"purple", "violet",}, {"red", "red",},
{"yellow", "yellow",}, {"white", "white",},
}
modname = "dye"
@ -29,7 +29,7 @@ for i in ipairs(recipe_list) do
local ingredient = recipe_list[i][2]
minetest.register_craft({
output = "abritorch:torch_"..colour.." 4",
output = "abritorch:torch_"..colour.." 4",
recipe = {
{"default:torch", "", "default:torch" },
{"", modname..":"..ingredient, "" },

View File

@ -1 +0,0 @@
default

View File

@ -1,4 +1,8 @@
local modpath = minetest.get_modpath("abritorch").. DIR_DELIM
abritorch = {}
dofile(modpath.."torches.lua")
dofile(modpath.."crafting.lua")
dofile(modpath.."crafting.lua")
abritorch.init = {}

3
mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = abritorch
depends = default
optional_depends = caverealms

View File

@ -1,9 +1,9 @@
local colour_list = {
{"black", "Darkened",}, {"blue", "Blue",},
{"cyan", "Cyan",}, {"green", "Green",},
{"magenta", "Magenta",}, {"orange", "Orange",},
{"purple", "Purple",}, {"red", "Red",},
{"cyan", "Cyan",}, {"green", "Green",},
{"magenta", "Magenta",}, {"orange", "Orange",},
{"purple", "Purple",}, {"red", "Red",},
{"yellow", "Yellow",}, {"white", "Frosted",},
}
@ -27,7 +27,7 @@ for i in ipairs(colour_list) do
return itemstack
end
local fakestack = itemstack
local retval = false
local retval
if wdir <= 1 then
retval = fakestack:set_name("abritorch:floor_"..colour)
else
@ -36,7 +36,7 @@ for i in ipairs(colour_list) do
if not retval then
return itemstack
end
itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, param2)
itemstack = minetest.item_place(fakestack, placer, pointed_thing)
itemstack:set_name("abritorch:torch_"..colour)
return itemstack