Skip to content

Commit

Permalink
Merge pull request #4 from BuckarooBanzay/luacheck
Browse files Browse the repository at this point in the history
luacheck, workflow and badge
  • Loading branch information
S-S-X committed Mar 5, 2020
2 parents 2c57efb + 49baa55 commit e618c6d
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 13 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/luacheck.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 25 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
6 changes: 3 additions & 3 deletions admin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions doors_chest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down
4 changes: 1 addition & 3 deletions pvp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e618c6d

Please sign in to comment.