Add luacheck
parent
152f164621
commit
3a17818e34
|
@ -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 ./
|
|
@ -0,0 +1,2 @@
|
||||||
|
*~
|
||||||
|
|
|
@ -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"
|
||||||
|
}
|
4
hud.lua
4
hud.lua
|
@ -22,12 +22,12 @@ minetest.register_playerstep(function(_, playernames)
|
||||||
if minetest.is_valid_pos(pos) then
|
if minetest.is_valid_pos(pos) then
|
||||||
local areaStrings = {}
|
local areaStrings = {}
|
||||||
|
|
||||||
for id, area in pairs(areas:getAreasAtPos(pos)) do
|
for id, area in pairs(areas:getAreasAtPos(pos)) do
|
||||||
areaStrings[#areaStrings+1] = ("%s [%u] (%s%s)")
|
areaStrings[#areaStrings+1] = ("%s [%u] (%s%s)")
|
||||||
:format(area.name, id, area.owner,
|
:format(area.name, id, area.owner,
|
||||||
area.open and ":open" or "")
|
area.open and ":open" or "")
|
||||||
end
|
end
|
||||||
|
|
||||||
local str = ""
|
local str = ""
|
||||||
for _, area in pairs(areas:getExternalHudEntries(pos)) do
|
for _, area in pairs(areas:getExternalHudEntries(pos)) do
|
||||||
if area.name then str = area.name .. " " end
|
if area.name then str = area.name .. " " end
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -39,7 +39,7 @@ minetest.register_node("areas:protector", {
|
||||||
minetest.chat_send_player(name, red(S("You have already protected this area.")))
|
minetest.chat_send_player(name, red(S("You have already protected this area.")))
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
local id = areas:add(name, S("Protector Block"), pos1, pos2)
|
local id = areas:add(name, S("Protector Block"), pos1, pos2)
|
||||||
areas:save()
|
areas:save()
|
||||||
minetest.chat_send_player(name,
|
minetest.chat_send_player(name,
|
||||||
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue