make atmos not suck so much and this also includes snowdrift

This commit is contained in:
Jordach 2017-11-26 18:33:34 +00:00
parent 955e144437
commit 6e87c8fdb9
5 changed files with 72 additions and 42 deletions

View File

@ -1 +1,2 @@
lightning
hudclock

View File

@ -14,17 +14,6 @@ minetest.register_chatcommand("ratio", {
})
minetest.register_chatcommand("change", {
description = "debugs the current atmos based weather system",
func = function(name)
atmos.weatherchange()
end,
})
--
atmos.weather_type = 1
@ -49,7 +38,7 @@ atmos.weather_sky_colour[3] = "#8bb9f9"
atmos.weather_sky_colour[4] = "#8bb9f9"
atmos.weather_sky_colour[5] = "#9b9b9b"
atmos.weather_sky_colour[6] = "#000409"
atmos.weather_sky_colour[7] = "#5a697c"
atmos.weather_sky_colour[7] = "#8b8b8b"
atmos.weather_sky_colour[8] = "#000409"
atmos.weather_sky_colour[9] = "#333b46"
atmos.weather_sky_colour[10] = "#000409"
@ -81,7 +70,7 @@ atmos.weather_light_level[3] = nil
atmos.weather_light_level[4] = nil
atmos.weather_light_level[5] = 0.8
atmos.weather_light_level[6] = 0.175
atmos.weather_light_level[7] = 0.7
atmos.weather_light_level[7] = 0.775
atmos.weather_light_level[8] = 0.175
atmos.weather_light_level[9] = 0.6
atmos.weather_light_level[10] = 0.175
@ -114,7 +103,7 @@ atmos.weather_cloud_colour[3] = "#fff0f0e5"
atmos.weather_cloud_colour[4] = "#fff0f0f5"
atmos.weather_cloud_colour[5] = "#9b9b9bff"
atmos.weather_cloud_colour[6] = "#797979ff"
atmos.weather_cloud_colour[7] = "#75869bff"
atmos.weather_cloud_colour[7] = "#93a2b3ff"
atmos.weather_cloud_colour[8] = "#6b6b6bff"
atmos.weather_cloud_colour[9] = "#4d5968ff"
atmos.weather_cloud_colour[10] = "#6b6b6bff"
@ -231,9 +220,9 @@ end
-- 3 = default (uses default dynamic skybox)
-- 4 = somewhat cloudy, not overcast enough (uses default dynamic skybox)
-- 5 = cloudy, overcast? (5 and 6)
-- 6 = raining (7 and 8)
-- 6 = raining (and snow in colder areas) (7 and 8)
-- 7 = thunderstorm (9 and 10)
-- 8 = snowing (13 and 14 on the atmos.weather_type chart)
-- 8 = snowing in all biomes exc. the desert (13 and 14 on the atmos.weather_type chart)
-- 9 = hailstorm (11 and 12)
function atmos.get_weather_skybox()
@ -322,9 +311,9 @@ function atmos.get_weather_skybox()
end
function atmos.weatherchange()
function atmos.weatherchange()
local rand = 1 --math.random(-1, 1)
local rand = math.random(-1, 1)
if rand == 0 then rand = -1 end
@ -332,23 +321,39 @@ function atmos.weatherchange()
atmos.current_weather = 5
elseif atmos.current_weather + rand == 5 then
elseif atmos.current_weather + rand == 6 and atmos.current_weather == 5 then
if hudclock.month == 1 or hudclock.month == 11 or hudclock.month == 12 then --is it winter months?
if math.random(1,8) == 1 then --hail
atmos.current_weather = 9
elseif math.random(1,3) == 1 then --snow in cool and cold areas
atmos.current_weather = 8
end
elseif hudclock.month == 5 or hudclock.month == 6 or hudclock.month == 7 then --is it summer?
if math.random(1,7) == 1 then -- thunder + rain
if math.random(1,4) == 1 then
atmos.current_weather = 7
elseif math.random(1,3) == 1 then -- rain
atmos.current_weather = 6
end
atmos.current_weather = 6
else -- other seasons just have rain.
elseif math.random(1,5) == 1 then
atmos.current_weather = 8
elseif math.random(1,7) == 1 then
atmos.current_weather = 7
elseif math.random(1,8) == 1 then
atmos.current_weather = 9
if math.random(1,3) == 1 then -- we rain, else if it's not the winter months, or summer thunder
atmos.current_weather = 6
end
end
@ -362,8 +367,6 @@ function atmos.weatherchange()
end
end
minetest.after(60+math.random(1,59)*math.random(1,5), atmos.weatherchange)
@ -391,5 +394,4 @@ minetest.after(math.random(43, 156), atmos.thunderstrike)
lightning.light_level = atmos.weather_light_level
-- abm to remove fires when it's raining, snowing or hailing?
-- abm to remove fires when it's raining, snowing or hailing?

View File

@ -88,10 +88,21 @@ function hudclock.update_calendar()
hudclock.day = totaldays
hudclock.month = totalmonths
hudclock.year = totalyears
minetest.after(25, hudclock.update_calendar)
end
--[[
seasonal table;
spring: 2, 3 and 4
summer: 5, 6 and 7
autumn: 8, 9 and 10
winter: 11, 12 and 1
]]--
minetest.after(1, hudclock.update_calendar)
-- minetest.register_chatcommand("hcr", {

View File

@ -1,2 +1,3 @@
core
atmos
hudclock

View File

@ -132,15 +132,30 @@ minetest.register_globalstep(function(dtime)
local hail = false
if atmos.current_weather == 6 or atmos.current_weather == 7 or atmos.current_weather == 8 and nval_humid > 24 and nval_temp > 36 and nval_temp < 61 then
minetest.chat_send_player(player_name, "temp: " .. nval_temp)
minetest.chat_send_player(player_name, "humid: " ..nval_humid)
if atmos.current_weather == 6 and nval_temp <= 40.5 then
precip = true
freeze = false
freeze = true
hail = false
elseif atmos.current_weather == 9 and nval_temp < 61 then
elseif atmos.current_weather == 6 or atmos.current_weather == 7 then
if nval_humid > 25 and nval_temp < 74 then
precip = true
freeze = false
hail = false
end
elseif atmos.current_weather == 9 and nval_humid > 25 and nval_temp < 74 then
precip = true
@ -148,8 +163,8 @@ minetest.register_globalstep(function(dtime)
hail = true
elseif atmos.current_weather == 8 and nval_temp < 37 then
elseif atmos.current_weather == 8 and nval_humid > 25 and nval_temp < 74 then
precip = true
freeze = true