Luacheck cleanups and .luacheckrc

Use `luacheck .` to run luacheck on this mod.

Cleaned up luacheck errors.
This commit is contained in:
Auke Kok 2016-10-18 09:33:30 -07:00
parent e6421d8d49
commit 3b6c0e5e78
9 changed files with 27 additions and 24 deletions

14
.luacheckrc Normal file
View File

@ -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",
}

View File

@ -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" })

View File

@ -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

View File

@ -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" },

View File

@ -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")

View File

@ -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
})

View File

@ -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")

View File

@ -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",

View File

@ -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)