diff --git a/init.lua b/init.lua index 37bd223..eb1c450 100644 --- a/init.lua +++ b/init.lua @@ -11,6 +11,12 @@ if minetest.get_modpath("happy_weather_api") == nil then dofile(modpath.."/commands.lua") end +legacy_MT_version = false +if minetest.get_humidity == nil then + minetest.log("warning", "MOD [weather_pack]: Old Minetest version detected, some mod features will not work.") + legacy_MT_version = true +end + -- Happy Weather utilities dofile(modpath.."/utils.lua") diff --git a/utils.lua b/utils.lua index 66267db..cd28497 100644 --- a/utils.lua +++ b/utils.lua @@ -78,23 +78,27 @@ hw_utils.get_random_pos = function(player, offset) end local is_biome_frozen = function(position) + if legacy_MT_version then + return false; + end local heat = minetest.get_heat(position) - print("karstis: " .. heat) -- below 35 heat biome considered to be frozen type return heat < 35 end hw_utils.is_biome_frozen = function(position) if mg_name == "v6" then - return false -- v6 not supported yet. + return false -- v6 not supported. end return is_biome_frozen(position) end local is_biome_dry = function(position) + if legacy_MT_version then + return false; + end local humidity = minetest.get_humidity(position) local heat = minetest.get_heat(position) - print("DREGME: " .. humidity) return humidity < 50 and heat > 65 end @@ -106,6 +110,9 @@ hw_utils.is_biome_dry = function(position) end local is_biome_tropic = function(position) + if legacy_MT_version then + return false; + end local humidity = minetest.get_humidity(position) local heat = minetest.get_heat(position) diff --git a/weathers/snowstorm.lua b/weathers/snowstorm.lua index 68536eb..39d8a19 100644 --- a/weathers/snowstorm.lua +++ b/weathers/snowstorm.lua @@ -11,8 +11,8 @@ local snowstorm = {} -- Weather identification code snowstorm.code = "snowstorm" snowstorm.last_check = 0 -snowstorm.check_interval = 5 -snowstorm.chance = 1 +snowstorm.check_interval = 300 +snowstorm.chance = 0.05 -- Keeps sound handler references local sound_handlers = {}