luacheck, workflow and badge

This commit is contained in:
BuckarooBanzay 2020-03-05 15:49:45 +01:00
parent 1fe04f2eba
commit 49baa55bd6
7 changed files with 55 additions and 13 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@v1
- 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 ./

25
.luacheckrc Normal file
View File

@ -0,0 +1,25 @@
unused = false
globals = {
"minetest",
"default",
"protector",
"register_door",
"register_trapdoor"
}
read_globals = {
-- Stdlib
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
-- Minetest
"vector", "ItemStack",
"dump", "VoxelArea",
-- deps
"intllib",
"mesecon",
"screwdriver",
"lucky_block"
}

View File

@ -1,5 +1,7 @@
Protector Redo mod [protect]
![](https://github.com/S-S-X/protector/workflows/luacheck/badge.svg)
Protector redo for minetest is a mod that protects a players builds by placing
a block that stops other players from digging or placing blocks in that area.

View File

@ -119,12 +119,12 @@ minetest.register_chatcommand("protector_show", {
func = function(name, param)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
local ppos = player:get_pos()
-- find the protector nodes
local pos = minetest.find_nodes_in_area(
{x = pos.x - r, y = pos.y - r, z = pos.z - r},
{x = pos.x + r, y = pos.y + r, z = pos.z + r},
{x = ppos.x - r, y = ppos.y - r, z = ppos.z - r},
{x = ppos.x + r, y = ppos.y + r, z = ppos.z + r},
{"protector:protect", "protector:protect2"})
local meta, owner

View File

@ -87,9 +87,9 @@ function register_door(name, def)
local tt = def.tiles_top
local tb = def.tiles_bottom
local function after_dig_node(pos, name, digger)
local function after_dig_node(pos, node_name, digger)
local node = minetest.get_node(pos)
if node.name == name then
if node.name == node_name then
minetest.node_dig(pos, node, digger)
end
end
@ -340,7 +340,7 @@ end
-- Protected Steel Door
local name = "protector:door_steel"
name = "protector:door_steel"
register_door(name, {
description = S("Protected Steel Door"),
@ -382,9 +382,9 @@ end
----trapdoor----
function register_trapdoor(name, def)
local name_closed = name
local name_opened = name.."_open"
function register_trapdoor(node_name, def)
local name_closed = node_name
local name_opened = node_name.."_open"
def.on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
if minetest.is_protected(pos, clicker:get_player_name()) then

View File

@ -217,7 +217,7 @@ protector.can_dig = function(r, pos, digger, onlyowner, infolevel)
end
-- find the protector nodes
local pos = minetest.find_nodes_in_area(
pos = minetest.find_nodes_in_area(
{x = pos.x - r, y = pos.y - r, z = pos.z - r},
{x = pos.x + r, y = pos.y + r, z = pos.z + r},
{"protector:protect", "protector:protect2"})

View File

@ -48,9 +48,7 @@ and minetest.settings:get_bool("protector_pvp") then
-- get time of day
local tod = minetest.get_timeofday() or 0
if tod > 0.2 and tod < 0.8 then
--
else
if tod <= 0.2 or tod >= 0.8 then
return false
end
end