From 66bd6a9b1df6cca5b25e49fdf2984cc85e9561e4 Mon Sep 17 00:00:00 2001 From: Buckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com> Date: Mon, 8 Jun 2020 21:52:11 +0200 Subject: [PATCH] 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 --- .github/workflows/luacheck.yml | 17 +++++++++++++++++ .luacheckrc | 10 ++++++++-- legacy.lua | 31 ------------------------------- 3 files changed, 25 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/luacheck.yml diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml new file mode 100644 index 0000000..4077f41 --- /dev/null +++ b/.github/workflows/luacheck.yml @@ -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 ./ diff --git a/.luacheckrc b/.luacheckrc index fc9c148..c47f79b 100644 --- a/.luacheckrc +++ b/.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"} } diff --git a/legacy.lua b/legacy.lua index eff281d..2f333fe 100644 --- a/legacy.lua +++ b/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