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) function mcl_weather.has_rain(pos)
if not mcl_worlds.has_weather(pos) then return false end if not mcl_worlds.has_weather(pos) then return false end
if mgname == "singlenode" or mgname == "v6" then return true end if mgname == "singlenode" or mgname == "v6" then return true end
local bd = minetest.get_biome_data(pos) if minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)]._mcl_biome_type == "hot" then return false end
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
return true return true
end end

View file

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