Luacheck cleanups and .luacheckrc
Use `luacheck .` to run luacheck on this mod. Cleaned up luacheck errors.
This commit is contained in:
parent
e6421d8d49
commit
3b6c0e5e78
14
.luacheckrc
Normal file
14
.luacheckrc
Normal 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",
|
||||
}
|
||||
|
2
corn.lua
2
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" })
|
||||
|
7
init.lua
7
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
|
||||
|
@ -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" },
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
})
|
||||
|
@ -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")
|
||||
|
@ -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",
|
||||
|
16
tools.lua
16
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user