From 379d07a8fc1946c6fc1aa54e40e17908f345a2f3 Mon Sep 17 00:00:00 2001 From: NatureFreshMilk Date: Tue, 10 Dec 2019 15:05:37 +0100 Subject: [PATCH] luacheck and fixes / no dep on vacuum --- .github/workflows/luacheck.yml | 17 +++++++++++++++++ .luacheckrc | 22 ++++++++++++++++++++++ depends.txt | 1 - drowning.lua | 6 ++---- hud.lua | 5 ----- readme.md | 3 +-- repair.lua | 26 -------------------------- 7 files changed, 42 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/luacheck.yml create mode 100644 .luacheckrc delete mode 100644 repair.lua diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml new file mode 100644 index 0000000..a03fe92 --- /dev/null +++ b/.github/workflows/luacheck.yml @@ -0,0 +1,17 @@ +name: luacheck + +on: [push] + +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 ./ diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..5739097 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,22 @@ +unused_args = false +allow_defined_top = true + +globals = { + "spacesuit", +} + +read_globals = { + -- Stdlib + string = {fields = {"split"}}, + table = {fields = {"copy", "getn"}}, + "call", + + -- Minetest + "minetest", + "vector", "ItemStack", + "dump", "VoxelArea", + + -- Deps + "unified_inventory", "default", "monitoring", + "armor" +} diff --git a/depends.txt b/depends.txt index 3666bf9..585cc7a 100644 --- a/depends.txt +++ b/depends.txt @@ -1,3 +1,2 @@ default 3d_armor -vacuum? diff --git a/drowning.lua b/drowning.lua index fb458c8..8adbb44 100644 --- a/drowning.lua +++ b/drowning.lua @@ -8,9 +8,7 @@ minetest.register_globalstep(function(dtime) local t0 = minetest.get_us_time() for _,player in ipairs(minetest.get_connected_players()) do - local name = player:get_player_name() - - local name, armor_inv = armor.get_valid_player(armor, player, "[spacesuit]") + local _, armor_inv = armor.get_valid_player(armor, player, "[spacesuit]") local has_helmet = armor_inv:contains_item("armor", "spacesuit:helmet") local has_chestplate = armor_inv:contains_item("armor", "spacesuit:chestplate") @@ -30,7 +28,7 @@ minetest.register_globalstep(function(dtime) if not stack:is_empty() then local name = stack:get_name() if name:sub(1, 10) == "spacesuit:" then - local use = minetest.get_item_group(name, "armor_use") * timer or 0 + local use = minetest.get_item_group(name, "armor_use") * timer or 0 armor:damage(player, i, stack, use) end end diff --git a/hud.lua b/hud.lua index 3d20823..8cca28f 100644 --- a/hud.lua +++ b/hud.lua @@ -161,9 +161,6 @@ spacesuit.set_player_wearing = function(player, has_full_suit, has_helmet, armor -- player wears it update_hud(player, has_full_suit, armor_list) - elseif not hud_data and not has_helmet then - -- player does not wear it - elseif hud_data and not has_helmet then -- player stopped wearing remove_hud(player) @@ -177,5 +174,3 @@ spacesuit.set_player_wearing = function(player, has_full_suit, has_helmet, armor end end - - diff --git a/readme.md b/readme.md index 5e99dcd..d80de04 100644 --- a/readme.md +++ b/readme.md @@ -1,11 +1,10 @@ # Intro -Spacesuit for minetest +Spacesuit mod for minetest # Dependencies * 3d_armor -* vacuum? # Features * Breathe in vacuum or water diff --git a/repair.lua b/repair.lua deleted file mode 100644 index b4e58dd..0000000 --- a/repair.lua +++ /dev/null @@ -1,26 +0,0 @@ -local has_vacuum = minetest.get_modpath("vacuum") - -if has_vacuum then - - function repair_recipe(partname) - minetest.register_craft({ - type = "shapeless", - output = partname, - recipe = { - "vacuum:air_bottle", - partname - }, - replacements = { - {"vacuum:air_bottle", "vessels:steel_bottle"} - } - }) - end - - repair_recipe("spacesuit:helmet") - repair_recipe("spacesuit:chestplate") - repair_recipe("spacesuit:pants") - repair_recipe("spacesuit:boots") - - -end -