fix weather count being 0
This commit is contained in:
parent
660c09fa7c
commit
b9aa145de3
|
@ -1,4 +1,5 @@
|
||||||
weather_mod.registered_downfalls = {}
|
weather_mod.registered_downfalls = {}
|
||||||
|
weather_mod.registered_downfall_count = 0
|
||||||
weather_mod.registered_weather_change_callbacks = {}
|
weather_mod.registered_weather_change_callbacks = {}
|
||||||
|
|
||||||
local function check_modname_prefix(name)
|
local function check_modname_prefix(name)
|
||||||
|
@ -86,6 +87,7 @@ function weather_mod.register_downfall(id,def)
|
||||||
end
|
end
|
||||||
--actually register the downfall
|
--actually register the downfall
|
||||||
weather_mod.registered_downfalls[name]=ndef
|
weather_mod.registered_downfalls[name]=ndef
|
||||||
|
weather_mod.registered_downfall_count = weather_mod.registered_downfall_count + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function weather_mod.register_on_weather_change(callback)
|
function weather_mod.register_on_weather_change(callback)
|
||||||
|
@ -200,7 +202,7 @@ minetest.register_globalstep(function()
|
||||||
end
|
end
|
||||||
weather_mod.handle_weather_change({type = "none", reason = "globalstep"})
|
weather_mod.handle_weather_change({type = "none", reason = "globalstep"})
|
||||||
else
|
else
|
||||||
local cnum = 10000 * #weather_mod.registered_downfalls
|
local cnum = 10000 * weather_mod.registered_downfall_count
|
||||||
for id,w in pairs(weather_mod.registered_downfalls) do
|
for id,w in pairs(weather_mod.registered_downfalls) do
|
||||||
if math.random(1, cnum) == 1 then
|
if math.random(1, cnum) == 1 then
|
||||||
weather.wind = {
|
weather.wind = {
|
||||||
|
|
Loading…
Reference in New Issue