mirror of
https://github.com/pandorabox-io/spacecannon.git
synced 2024-12-30 09:37:29 +01:00
add luacheck workflow
This commit is contained in:
parent
3475d4deef
commit
419d663e15
18
.github/workflows/luacheck.yml
vendored
Normal file
18
.github/workflows/luacheck.yml
vendored
Normal 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 ./
|
@ -1,8 +1,4 @@
|
|||||||
unused_args = false
|
|
||||||
allow_defined_top = true
|
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
"minetest",
|
|
||||||
"spacecannon"
|
"spacecannon"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12,7 +8,7 @@ read_globals = {
|
|||||||
table = {fields = {"copy", "getn"}},
|
table = {fields = {"copy", "getn"}},
|
||||||
|
|
||||||
-- mod deps
|
-- mod deps
|
||||||
"technic", "default",
|
"technic", "default", "digilines",
|
||||||
|
|
||||||
-- Minetest
|
-- Minetest
|
||||||
"minetest",
|
"minetest",
|
||||||
|
20
cannon.lua
20
cannon.lua
@ -49,7 +49,7 @@ local register_spacecannon = function(def)
|
|||||||
if goes_through then
|
if goes_through then
|
||||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
|
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
|
||||||
local collided = false
|
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
|
if obj:get_luaentity() ~= nil and obj:get_luaentity().name ~= self.name then
|
||||||
collided = true
|
collided = true
|
||||||
obj:punch(self.object, 1.0, {
|
obj:punch(self.object, 1.0, {
|
||||||
@ -72,7 +72,7 @@ local register_spacecannon = function(def)
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self)
|
||||||
minetest.after(def.timeout,
|
minetest.after(def.timeout,
|
||||||
function(me)
|
function(me)
|
||||||
me.object:remove()
|
me.object:remove()
|
||||||
@ -103,7 +103,7 @@ local register_spacecannon = function(def)
|
|||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
|
|
||||||
mesecons = {effector = {
|
mesecons = {effector = {
|
||||||
action_on = function (pos, node)
|
action_on = function (pos)
|
||||||
spacecannon.fire(pos, def.color, def.speed, def.range)
|
spacecannon.fire(pos, def.color, def.speed, def.range)
|
||||||
end
|
end
|
||||||
}},
|
}},
|
||||||
@ -140,7 +140,7 @@ local register_spacecannon = function(def)
|
|||||||
spacecannon.update_formspec(meta)
|
spacecannon.update_formspec(meta)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
technic_run = function(pos, node)
|
technic_run = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local eu_input = meta:get_int("HV_EU_input")
|
local eu_input = meta:get_int("HV_EU_input")
|
||||||
local demand = meta:get_int("HV_EU_demand")
|
local demand = meta:get_int("HV_EU_demand")
|
||||||
@ -159,7 +159,13 @@ local register_spacecannon = function(def)
|
|||||||
end
|
end
|
||||||
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)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
if fields.fire then
|
if fields.fire then
|
||||||
@ -219,7 +225,3 @@ register_spacecannon({
|
|||||||
desc = "slow, heavy damage",
|
desc = "slow, heavy damage",
|
||||||
ingredient = "spacecannon:cannon_yellow"
|
ingredient = "spacecannon:cannon_yellow"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ spacecannon.digiline_rules = {
|
|||||||
{x= 0,y= 1,z= 0},{x= 0,y=-1,z= 0}, -- along y above and below
|
{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 meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
local input = meta:get_int("HV_EU_input")
|
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)
|
digilines.receptor_send(pos, spacecannon.digiline_rules, channel, resp)
|
||||||
end
|
end
|
||||||
|
|
||||||
spacecannon.digiline_handler_fire = function(pos, node, channel, msg)
|
spacecannon.digiline_handler_fire = function(pos, node, channel)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
-- TODO: Add ability to set "target node" in the msg, and if its within
|
-- TODO: Add ability to set "target node" in the msg, and if its within
|
||||||
|
8
util.lua
8
util.lua
@ -27,11 +27,13 @@ spacecannon.update_formspec = function(meta)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
spacecannon.can_shoot = function(pos)
|
spacecannon.can_shoot = function()
|
||||||
|
-- arguments: pos
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
spacecannon.can_destroy = function(pos)
|
spacecannon.can_destroy = function()
|
||||||
|
-- arguments: pos
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -173,5 +175,3 @@ spacecannon.facedir_to_down_dir = function(facing)
|
|||||||
{x=1, y=0, z=0},
|
{x=1, y=0, z=0},
|
||||||
{x=0, y=1, z=0}})[math.floor(facing/4)]
|
{x=0, y=1, z=0}})[math.floor(facing/4)]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user