mirror of
https://github.com/minetest-mods/areas.git
synced 2024-12-23 17:20:41 +01:00
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:
parent
aa3e35acbe
commit
66bd6a9b1d
17
.github/workflows/luacheck.yml
vendored
Normal file
17
.github/workflows/luacheck.yml
vendored
Normal 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 ./
|
10
.luacheckrc
10
.luacheckrc
@ -1,5 +1,4 @@
|
||||
unused_args = false
|
||||
allow_defined_top = true
|
||||
|
||||
read_globals = {
|
||||
"DIR_DELIM",
|
||||
@ -10,9 +9,16 @@ read_globals = {
|
||||
"PseudoRandom", "ItemStack",
|
||||
"AreaStore",
|
||||
"default",
|
||||
"factions",
|
||||
table = { fields = { "copy", "getn" } }
|
||||
}
|
||||
|
||||
globals = {
|
||||
"minetest"
|
||||
"minetest",
|
||||
-- mod namespace
|
||||
"areas"
|
||||
}
|
||||
|
||||
files["legacy.lua"] = {
|
||||
ignore = {"512"}
|
||||
}
|
||||
|
31
legacy.lua
31
legacy.lua
@ -106,34 +106,3 @@ function areas.hasOwner(pos)
|
||||
end
|
||||
return false
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user