summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <sofar@foo-projects.org>2016-10-18 09:33:30 -0700
committerAuke Kok <sofar@foo-projects.org>2016-10-18 09:33:30 -0700
commit3b6c0e5e782b0dc9935e9c9c363475c733bde92a (patch)
tree06dc292b19da6f6d64311dd0b1e2901c8ac8f37f
parente6421d8d495c4415eeae80c7b1a2ce20d55e443d (diff)
Luacheck cleanups and .luacheckrc
Use `luacheck .` to run luacheck on this mod. Cleaned up luacheck errors.
-rw-r--r--.luacheckrc14
-rw-r--r--corn.lua2
-rw-r--r--init.lua7
-rw-r--r--mapgen.lua4
-rw-r--r--melon.lua1
-rw-r--r--potato.lua4
-rw-r--r--pumpkin.lua1
-rw-r--r--tomato.lua2
-rw-r--r--tools.lua16
9 files changed, 27 insertions, 24 deletions
diff --git a/.luacheckrc b/.luacheckrc
new file mode 100644
index 0000000..fbf3483
--- /dev/null
+++ b/.luacheckrc
@@ -0,0 +1,14 @@
+unused_args = false
+allow_defined_top = true
+
+read_globals = {
+ "DIR_DELIM",
+ "minetest", "core",
+ "dump",
+ "vector", "nodeupdate",
+ "VoxelManip", "VoxelArea",
+ "PseudoRandom", "ItemStack",
+ "intllib",
+ "default",
+}
+
diff --git a/corn.lua b/corn.lua
index 71afba2..cd0e272 100644
--- a/corn.lua
+++ b/corn.lua
@@ -128,8 +128,6 @@ minetest.register_abm({
if not minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" then
return
end
- local meta = minetest.get_meta(pos)
- local water = meta:get_int("crops_water")
minetest.swap_node(pos, { name = "crops:corn_base_2" })
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
minetest.set_node(above , { name = "crops:corn_top_1" })
diff --git a/init.lua b/init.lua
index 764db29..537edd9 100644
--- a/init.lua
+++ b/init.lua
@@ -159,7 +159,6 @@ crops.can_grow = function(pos)
end
crops.particles = function(pos, flag)
- local p = {}
if flag == 0 then
-- wither (0)
minetest.add_particlespawner({
@@ -337,7 +336,7 @@ if crops.settings.hydration then
if not f == nil then
water = math.min(100, water + 2)
else
- local f = minetest.find_node_near(pos, 2, {"default:water_source", "default:water_flowing"})
+ f = minetest.find_node_near(pos, 2, {"default:water_source", "default:water_flowing"})
if not f == nil then
water = math.min(100, water + 1)
end
@@ -356,8 +355,8 @@ if crops.settings.hydration then
-- for convenience, copy water attribute to top half
if not plant.properties.doublesize == nil and plant.properties.doublesize then
local above = { x = pos.x, y = pos.y + 1, z = pos.z}
- local meta = minetest.get_meta(above)
- meta:set_int("crops_water", water)
+ local abovemeta = minetest.get_meta(above)
+ abovemeta:set_int("crops_water", water)
end
if water <= plant.properties.wither_damage then
diff --git a/mapgen.lua b/mapgen.lua
index 9744584..b9ce6d0 100644
--- a/mapgen.lua
+++ b/mapgen.lua
@@ -1,8 +1,6 @@
local mg_params = minetest.get_mapgen_params()
-if mg_params.mgname == "v6" then
- -- not supported at this point
-elseif mg_params.mgname ~= "singlenode" then
+if mg_params.mgname ~= "v6" and mg_params.mgname ~= "singlenode" then
minetest.register_decoration({
deco_type = "simple",
place_on = { "default:dirt_with_grass" },
diff --git a/melon.lua b/melon.lua
index 66efc03..7043ad3 100644
--- a/melon.lua
+++ b/melon.lua
@@ -149,7 +149,6 @@ minetest.register_abm({
if not crops.can_grow(pos) then
return
end
- local meta = minetest.get_meta(pos)
local n = string.gsub(node.name, "4", "5")
n = string.gsub(n, "3", "4")
n = string.gsub(n, "2", "3")
diff --git a/potato.lua b/potato.lua
index 408e87b..1c7b9e7 100644
--- a/potato.lua
+++ b/potato.lua
@@ -160,11 +160,9 @@ minetest.register_abm({
return
end
local meta = minetest.get_meta(pos)
- local water = meta:get_int("crops_water")
local damage = meta:get_int("crops_damage")
- local below = { x = pos.x, y = pos.y - 1, z = pos.z}
minetest.set_node(below, { name = "crops:soil_with_potatoes" })
- local meta = minetest.get_meta(below)
+ meta = minetest.get_meta(below)
meta:set_int("crops_damage", damage)
end
})
diff --git a/pumpkin.lua b/pumpkin.lua
index bf08374..1c1c3e0 100644
--- a/pumpkin.lua
+++ b/pumpkin.lua
@@ -143,7 +143,6 @@ minetest.register_abm({
if not crops.can_grow(pos) then
return
end
- local meta = minetest.get_meta(pos)
local n = string.gsub(node.name, "4", "5")
n = string.gsub(n, "3", "4")
n = string.gsub(n, "2", "3")
diff --git a/tomato.lua b/tomato.lua
index d14658e..a659961 100644
--- a/tomato.lua
+++ b/tomato.lua
@@ -13,8 +13,6 @@ of the license, or (at your option) any later version.
-- Intllib
local S = crops.intllib
-local wateruse = 1
-
minetest.register_node("crops:tomato_seed", {
description = S("Tomato seed"),
inventory_image = "crops_tomato_seed.png",
diff --git a/tools.lua b/tools.lua
index c406223..cb80788 100644
--- a/tools.lua
+++ b/tools.lua
@@ -31,19 +31,19 @@ minetest.register_tool("crops:watering_can", {
if minetest.get_item_group(minetest.get_node(pos).name, "water") >= 3 then
if wear ~= 1 then
minetest.sound_play("crops_watercan_entering", {pos=pos, gain=0.8})
- minetest.after(math.random()/2, function(pos)
+ minetest.after(math.random()/2, function(p)
if math.random(2) == 1 then
- minetest.sound_play("crops_watercan_splash_quiet", {pos=pos, gain=0.1})
+ minetest.sound_play("crops_watercan_splash_quiet", {pos=p, gain=0.1})
end
if math.random(3) == 1 then
- minetest.after(math.random()/2, function(pos)
- minetest.sound_play("crops_watercan_splash_small", {pos=pos, gain=0.7})
- end, pos)
+ minetest.after(math.random()/2, function(pp)
+ minetest.sound_play("crops_watercan_splash_small", {pos=pp, gain=0.7})
+ end, p)
end
if math.random(3) == 1 then
- minetest.after(math.random()/2, function(pos)
- minetest.sound_play("crops_watercan_splash_big", {pos=pos, gain=0.7})
- end, pos)
+ minetest.after(math.random()/2, function(pp)
+ minetest.sound_play("crops_watercan_splash_big", {pos=pp, gain=0.7})
+ end, p)
end
end, pos)
itemstack:set_wear(1)