Add luacheck

master
MoNTE48 2021-04-24 12:33:01 +02:00
parent 152f164621
commit 3a17818e34
6 changed files with 48 additions and 7 deletions

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

@ -0,0 +1,17 @@
name: luacheck
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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 ./

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*~

22
.luacheckrc Normal file
View File

@ -0,0 +1,22 @@
unused_args = false
read_globals = {
"DIR_DELIM",
"core",
"dump",
"vector", "nodeupdate",
"VoxelManip", "VoxelArea",
"PseudoRandom", "ItemStack",
"AreaStore",
"default",
"intllib",
"hud",
"mesecon",
table = { fields = { "copy", "getn", "indexof" } }
}
globals = {
"minetest",
-- mod namespace
"areas"
}

View File

@ -34,7 +34,6 @@ function areas:load()
return err return err
end end
local data = file:read("*a") local data = file:read("*a")
local err
if data:sub(1, 1) == "[" then if data:sub(1, 1) == "[" then
self.areas, err = minetest.parse_json(data) self.areas, err = minetest.parse_json(data)
else else

View File

@ -69,7 +69,8 @@ minetest.register_node("areas:protector", {
end, end,
on_punch = function(pos) on_punch = function(pos)
local objs = minetest.get_objects_inside_radius(pos, 0.5) -- a radius of 0.5 since the entity serialization seems to be not that precise -- a radius of 0.5 since the entity serialization seems to be not that precise
local objs = minetest.get_objects_inside_radius(pos, 0.5)
local displayed = false local displayed = false
for _, o in pairs(objs) do for _, o in pairs(objs) do
if not o:is_player() and o:get_luaentity().name == "areas:display" then if not o:is_player() and o:get_luaentity().name == "areas:display" then
@ -84,12 +85,12 @@ minetest.register_node("areas:protector", {
}) })
-- entities code below (and above) mostly copied-pasted from Zeg9's protector mod -- entities code below (and above) mostly copied-pasted from Zeg9's protector mod
minetest.register_entity("areas:display", { minetest.register_entity("areas:display", {
physical = false, physical = false,
collisionbox = {0}, collisionbox = {0},
visual = "wielditem", visual = "wielditem",
visual_size = {x = 1.0 / 1.5, y = 1.0 / 1.5}, -- wielditem seems to be scaled to 1.5 times original node size -- wielditem seems to be scaled to 1.5 times original node size
visual_size = {x = 1.0 / 1.5, y = 1.0 / 1.5},
textures = {"areas:display_node"}, textures = {"areas:display_node"},
timer = 0, timer = 0,
on_step = function(self, dtime) on_step = function(self, dtime)