use _mcl_biome_type for weather

This commit is contained in:
cora 2022-07-31 04:46:06 +02:00
parent 50840f6bdc
commit bb496db605
2 changed files with 6 additions and 10 deletions

View File

@ -44,10 +44,7 @@ local textures = {"weather_pack_rain_raindrop_1.png", "weather_pack_rain_raindro
function mcl_weather.has_rain(pos)
if not mcl_worlds.has_weather(pos) then return false end
if mgname == "singlenode" or mgname == "v6" then return true end
local bd = minetest.get_biome_data(pos)
local bn = minetest.get_biome_name(bd.biome)
if not mcl_worlds.has_weather(pos) or bn:find("Desert") or bd.heat > 85 then
return false end
if minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)]._mcl_biome_type == "hot" then return false end
return true
end

View File

@ -66,12 +66,11 @@ function mcl_weather.has_snow(pos)
if mgname == "singlenode" or mgname == "v6" then return true end
local bd = minetest.get_biome_data(pos)
local bn = minetest.get_biome_name(bd.biome)
local minheight = -64
if bn:find("Taiga") then minheight = 100 end
if bn:find("ColdTaiga") then minheight = 0 end
if bn:find("MegaSpruce") then minheight = 140 end
if pos.y < minheight then return false end
if table.indexof(snow_biomes,bn) ~= -1 then return true end
if minetest.registered_biomes[bn]._mcl_biome_type == "snowy" then return true end
if minetest.registered_biomes[bn]._mcl_biome_type == "cold" then
if bn == "Taiga" and pos.y > 140 then return true end
if bn == "MegaSpruceTaiga" and pos.y > 100 then return true end
end
return false
end