add .luacheckrc and fix common errors

This commit is contained in:
BuckarooBanzay 2019-10-11 08:12:18 +02:00 committed by SmallJoker
parent 39bd36cc17
commit 3136adbe00
2 changed files with 21 additions and 2 deletions

19
.luacheckrc Normal file
View File

@ -0,0 +1,19 @@
globals = {
"lightning"
}
read_globals = {
-- Stdlib
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
"PcgRandom",
-- Minetest
"minetest",
"vector", "ItemStack",
"dump",
-- mods
"default", "fire"
}

View File

@ -34,7 +34,7 @@ local revertsky = function()
return return
end end
for key, entry in pairs(ps) do for _, entry in pairs(ps) do
local sky = entry.sky local sky = entry.sky
entry.p:set_sky(sky.bgcolor, sky.type, sky.textures) entry.p:set_sky(sky.bgcolor, sky.type, sky.textures)
end end
@ -217,7 +217,7 @@ minetest.register_node("lightning:dying_flame", {
}) })
-- if other mods disable auto lightning during initialization, don't trigger the first lightning. -- if other mods disable auto lightning during initialization, don't trigger the first lightning.
minetest.after(5, function(dtime) minetest.after(5, function()
if lightning.auto then if lightning.auto then
minetest.after(rng:next(lightning.interval_low, minetest.after(rng:next(lightning.interval_low,
lightning.interval_high), lightning.strike) lightning.interval_high), lightning.strike)