Add luacheck CI and drop node_ownership remnants (#44)

`node_ownership` is long dead, and pollutes the global namespace. Support dropped after ~7 years.

Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
This commit is contained in:
Buckaroo Banzai 2020-06-08 21:52:11 +02:00 committed by GitHub
parent aa3e35acbe
commit 66bd6a9b1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 33 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 ./

View File

@ -1,5 +1,4 @@
unused_args = false unused_args = false
allow_defined_top = true
read_globals = { read_globals = {
"DIR_DELIM", "DIR_DELIM",
@ -10,9 +9,16 @@ read_globals = {
"PseudoRandom", "ItemStack", "PseudoRandom", "ItemStack",
"AreaStore", "AreaStore",
"default", "default",
"factions",
table = { fields = { "copy", "getn" } } table = { fields = { "copy", "getn" } }
} }
globals = { globals = {
"minetest" "minetest",
-- mod namespace
"areas"
}
files["legacy.lua"] = {
ignore = {"512"}
} }

View File

@ -106,34 +106,3 @@ function areas.hasOwner(pos)
end end
return false return false
end end
IsPlayerNodeOwner = areas.isNodeOwner
GetNodeOwnerName = areas.getNodeOwnerName
HasOwner = areas.hasOwner
-- This is entirely untested and may break in strange and new ways.
if areas.config.legacy_table then
owner_defs = setmetatable({}, {
__index = function(table, key)
local a = rawget(areas.areas, key)
if not a then return a end
local b = {}
for k, v in pairs(a) do b[k] = v end
b.x1, b.y1, b.z1 = b.pos1.x, b.pos1.y, b.pos1.z
b.x2, b.y1, b.z2 = b.pos2.x, b.pos2.y, b.pos2.z
b.pos1, b.pos2 = nil, nil
b.id = key
return b
end,
__newindex = function(table, key, value)
local a = value
a.pos1, a.pos2 = {x=a.x1, y=a.y1, z=a.z1},
{x=a.x2, y=a.y2, z=a.z2}
a.x1, a.y1, a.z1, a.x2, a.y2, a.z2 =
nil, nil, nil, nil, nil, nil
a.name = a.name or S("unnamed")
a.id = nil
return rawset(areas.areas, key, a)
end
})
end