Tweak weather durations to be more MC-like

This commit is contained in:
Wuzzy 2017-11-12 05:02:20 +01:00
parent 562bd6cd5a
commit f052f147b5
4 changed files with 26 additions and 12 deletions

@ -175,13 +175,6 @@ rain.make_weather = function()
end
end
if weather.reg_weathers.rain == nil then
weather.reg_weathers.rain = {
chance = 15,
clear = rain.clear
}
end
-- Switch the number of raindrops: "thunder" for many raindrops, otherwise for normal raindrops
rain.set_particles_mode = function(mode)
if mode == "thunder" then
@ -242,3 +235,13 @@ if weather.allow_abm then
end
})
end
if weather.reg_weathers.rain == nil then
weather.reg_weathers.rain = {
chance = 15,
clear = rain.clear,
-- 10min - 20min
min_duration = 300,
max_duration = 600,
}
end

@ -84,7 +84,10 @@ end)
if weather.reg_weathers.snow == nil then
weather.reg_weathers.snow = {
chance = 10,
clear = snow.clear
clear = snow.clear,
-- 10min - 20min
min_duration = 300,
max_duration = 600,
}
end

@ -51,7 +51,8 @@ if weather.reg_weathers.thunder == nil then
weather.reg_weathers.thunder = {
chance = 5,
clear = thunder.clear,
min_duration = 120,
-- 10min - 20min
min_duration = 300,
max_duration = 600,
}
end

@ -9,13 +9,13 @@ weather = {
next_check = 0,
-- default weather recalculation interval
check_interval = 300,
check_interval = 150,
-- weather min duration
min_duration = 240,
min_duration = 300,
-- weather max duration
max_duration = 3600,
max_duration = 9000,
-- weather calculated end time
end_time = nil,
@ -152,6 +152,7 @@ minetest.register_chatcommand("weather", {
weather.reg_weathers[weather.state].clear()
end
weather.state = "none"
weather.end_time = weather.get_rand_end_time()
success = true
return
end
@ -159,6 +160,8 @@ minetest.register_chatcommand("weather", {
if (weather.reg_weathers ~= nil and weather.reg_weathers[param] ~= nil) then
if (weather.state ~= nil and weather.state ~= "none" and weather.reg_weathers[weather.state] ~= nil) then
weather.reg_weathers[weather.state].clear()
local weather_meta = weather.reg_weathers[weather.state]
weather.end_time = weather.get_rand_end_time(weather_meta.min_duration, weather_meta.max_duration)
end
weather.state = param
return
@ -179,6 +182,8 @@ minetest.register_chatcommand("toggledownfall", {
weather.reg_weathers[weather.state].clear()
end
weather.state = "none"
weather.end_time = weather.get_rand_end_time()
-- Currently clear: Set weather randomly to rain/thunder/snow
else
local new = { "rain", "thunder", "snow" }
@ -187,6 +192,8 @@ minetest.register_chatcommand("toggledownfall", {
weather.reg_weathers[weather.state].clear()
end
weather.state = new[r]
local weather_meta = weather.reg_weathers[weather.state]
weather.end_time = weather.get_rand_end_time(weather_meta.min_duration, weather_meta.max_duration)
end
end
})