add luacheck workflow

master
BuckarooBanzay 2021-01-10 19:34:08 +01:00
parent 3475d4deef
commit 419d663e15
5 changed files with 36 additions and 20 deletions

18
.github/workflows/luacheck.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: luacheck
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2.3.4
- 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,8 +1,4 @@
unused_args = false
allow_defined_top = true
globals = {
"minetest",
"spacecannon"
}
@ -12,7 +8,7 @@ read_globals = {
table = {fields = {"copy", "getn"}},
-- mod deps
"technic", "default",
"technic", "default", "digilines",
-- Minetest
"minetest",

View File

@ -49,7 +49,7 @@ local register_spacecannon = function(def)
if goes_through then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
local collided = false
for k, obj in pairs(objs) do
for _, obj in pairs(objs) do
if obj:get_luaentity() ~= nil and obj:get_luaentity().name ~= self.name then
collided = true
obj:punch(self.object, 1.0, {
@ -72,7 +72,7 @@ local register_spacecannon = function(def)
end
end,
on_activate = function(self, staticdata)
on_activate = function(self)
minetest.after(def.timeout,
function(me)
me.object:remove()
@ -103,7 +103,7 @@ local register_spacecannon = function(def)
legacy_facedir_simple = true,
mesecons = {effector = {
action_on = function (pos, node)
action_on = function (pos)
spacecannon.fire(pos, def.color, def.speed, def.range)
end
}},
@ -140,7 +140,7 @@ local register_spacecannon = function(def)
spacecannon.update_formspec(meta)
end,
technic_run = function(pos, node)
technic_run = function(pos)
local meta = minetest.get_meta(pos)
local eu_input = meta:get_int("HV_EU_input")
local demand = meta:get_int("HV_EU_demand")
@ -159,7 +159,13 @@ local register_spacecannon = function(def)
end
end,
on_receive_fields = function(pos, formname, fields, sender)
on_receive_fields = function(pos, _, fields, sender)
local playername = sender and sender:get_player_name() or ""
if minetest.is_protected(pos, playername) then
-- only allow protection-owner to fire and configure
return
end
local meta = minetest.get_meta(pos)
if fields.fire then
@ -219,7 +225,3 @@ register_spacecannon({
desc = "slow, heavy damage",
ingredient = "spacecannon:cannon_yellow"
})

View File

@ -10,7 +10,7 @@ spacecannon.digiline_rules = {
{x= 0,y= 1,z= 0},{x= 0,y=-1,z= 0}, -- along y above and below
}
spacecannon.digiline_handler_get = function(pos, node, channel, msg)
spacecannon.digiline_handler_get = function(pos, node, channel)
local meta = minetest.get_meta(pos)
local input = meta:get_int("HV_EU_input")
@ -31,7 +31,7 @@ spacecannon.digiline_handler_get = function(pos, node, channel, msg)
digilines.receptor_send(pos, spacecannon.digiline_rules, channel, resp)
end
spacecannon.digiline_handler_fire = function(pos, node, channel, msg)
spacecannon.digiline_handler_fire = function(pos, node, channel)
local meta = minetest.get_meta(pos)
-- TODO: Add ability to set "target node" in the msg, and if its within

View File

@ -27,11 +27,13 @@ spacecannon.update_formspec = function(meta)
end
end
spacecannon.can_shoot = function(pos)
spacecannon.can_shoot = function()
-- arguments: pos
return true
end
spacecannon.can_destroy = function(pos)
spacecannon.can_destroy = function()
-- arguments: pos
return true
end
@ -173,5 +175,3 @@ spacecannon.facedir_to_down_dir = function(facing)
{x=1, y=0, z=0},
{x=0, y=1, z=0}})[math.floor(facing/4)]
end