Commit 2a8c2d05 authored by Artūras's avatar Artūras

MT 0.4.16 compatibility fixes and code clean-up.

parent c6987629
......@@ -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")
......
......@@ -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)
......
......@@ -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 = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment