add luacheck, fix errors, add github actions

This commit is contained in:
unknown 2021-11-28 01:28:44 -05:00
parent 0a43ffe46a
commit 92ee7e419e
4 changed files with 45 additions and 23 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
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_args = false
allow_defined_top = true
exclude_files = {".luacheckrc"}
globals = {
"minetest", "core",
--mod provided
}
read_globals = {
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
--luac
"math", "table",
-- Builtin
"vector", "ItemStack", "dump", "DIR_DELIM", "VoxelArea", "Settings", "PcgRandom", "VoxelManip", "PseudoRandom",
--mod produced
"default", "screwdriver", "unifieddyes", "computers",
}

View File

@ -1,21 +0,0 @@
unused_args = false
allow_defined_top = true
max_comment_line_length = 999
read_globals = {
"DIR_DELIM",
"minetest", "core",
"unpack",
"dump",
table = { fields = { "copy", "getn" } },
"vector", "nodeupdate",
"VoxelManip", "VoxelArea",
"PseudoRandom", "ItemStack",
"default",
"unifieddyes",
"screwdriver",
}
globals = {
}

View File

@ -79,7 +79,7 @@ minetest.register_node("home_workshop_misc:beer_mug", {
sounds = default.node_sound_glass_defaults(),
selection_box = beer_cbox,
on_use = function(itemstack, user, pointed_thing)
if not creative.is_enabled_for(user:get_player_name()) then
if not minetest.is_creative_enabled_for(user:get_player_name()) then
minetest.do_item_eat(2, "vessels:drinking_glass 1", itemstack, user, pointed_thing)
return itemstack
end
@ -116,7 +116,7 @@ minetest.register_node("home_workshop_misc:soda_machine", {
minetest.sound_play("insert_coin", {
pos=pos, max_hear_distance = 5
})
if not creative.is_enabled_for(playername) then
if not minetest.is_creative_enabled_for(playername) then
wielditem:take_item()
clicker:set_wielded_item(wielditem)
return wielditem