From 4ac2019e5abcc9aa59eb829d055aac81283a7bda Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 5 Feb 2020 20:18:22 -0600 Subject: [PATCH] Add luacheck (#1) --- .github/workflows/check-release.yml | 11 +++++++++++ .luacheckrc | 24 ++++++++++++++++++++++++ README.md | 2 ++ redtrees/init.lua | 6 +++--- sakuragi/init.lua | 6 +++--- 5 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/check-release.yml create mode 100644 .luacheckrc diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml new file mode 100644 index 0000000..d32b9ae --- /dev/null +++ b/.github/workflows/check-release.yml @@ -0,0 +1,11 @@ +on: [push, pull_request] +name: Check & Release +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: lint + uses: Roang-zero1/factorio-mod-luacheck@master + with: + luacheckrc_url: https://raw.githubusercontent.com/BlockySurvival/redtrees/master/.luacheckrc diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..fb4b3a7 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,24 @@ +unused_args = false +allow_defined_top = true +max_line_length = 999 + +ignore = { + "can_grow", + "x", + "y", + "z", +} + +globals = { + "minetest" +} + +read_globals = { + string = {fields = {"split", "trim"}}, + table = {fields = {"copy", "getn"}}, + + "VoxelArea", "biome_lib", + "intllib", "default", "doors", + + "stairs", "bonemeal", +} diff --git a/README.md b/README.md index 590e6bc..311001d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # redtrees +[![](https://github.com/BlockySurvival/redtrees/workflows/Check%20&%20Release/badge.svg)](https://github.com/BlockySurvival/redtrees/actions) + Originally: https://forum.minetest.net/viewtopic.php?f=11&t=13102 More currently: https://notabug.org/Piezo_/minetest_madman_server/src/master/redtrees diff --git a/redtrees/init.lua b/redtrees/init.lua index e47da8d..13bafd3 100644 --- a/redtrees/init.lua +++ b/redtrees/init.lua @@ -34,7 +34,7 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, [minetest.get_content_id("default:grass_4")] = true, [minetest.get_content_id("default:grass_5")] = true, } - + --TRUNK!!! EXCITEMENT!!! for y_dist = 0, height - 1 do local vi = a:index(x, y + y_dist, z) @@ -57,13 +57,13 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, end end end - + for _,vi in pairs({ --Add a small ring of leaves at the bottom of the canopy, for more realism. a:index(x + 1, y + height - (size + 1), z), a:index(x - 1, y + height - (size + 1), z), a:index(x, y + height - (size + 1), z + 1), a:index(x, y + height - (size + 1), z - 1) - + }) do if data[vi] == c_air or data[vi] == c_ignore or grow_over[data[vi]]then data[vi] = leaves_cid diff --git a/sakuragi/init.lua b/sakuragi/init.lua index d3f0a9d..a278b43 100644 --- a/sakuragi/init.lua +++ b/sakuragi/init.lua @@ -34,7 +34,7 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, [minetest.get_content_id("default:grass_4")] = true, [minetest.get_content_id("default:grass_5")] = true, } - + --TRUNK!!! EXCITEMENT!!! for y_dist = 0, height - 1 do local vi = a:index(x, y + y_dist, z) @@ -57,13 +57,13 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, end end end - + for _,vi in pairs({ --Add a small ring of leaves at the bottom of the canopy, for more realism. a:index(x + 1, y + height - (size + 1), z), a:index(x - 1, y + height - (size + 1), z), a:index(x, y + height - (size + 1), z + 1), a:index(x, y + height - (size + 1), z - 1) - + }) do if data[vi] == c_air or data[vi] == c_ignore or grow_over[data[vi]]then data[vi] = leaves_cid