fix crash in mapgen v6

This commit is contained in:
cora 2022-07-31 05:24:23 +02:00
parent cae11f99e4
commit 4a6f98636d
2 changed files with 8 additions and 7 deletions

View file

@ -44,7 +44,8 @@ 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
if minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)]._mcl_biome_type == "hot" then return false end local bd = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)]
if bd and bd._mcl_biome_type == "hot" then return false end
return true return true
end end

View file

@ -4,7 +4,7 @@ mcl_weather.snow = {}
local PARTICLES_COUNT_SNOW = tonumber(minetest.settings:get("mcl_weather_snow_particles")) or 100 local PARTICLES_COUNT_SNOW = tonumber(minetest.settings:get("mcl_weather_snow_particles")) or 100
mcl_weather.snow.init_done = false mcl_weather.snow.init_done = false
local mgname = minetest.get_mapgen_setting("mgname") local mgname = minetest.get_mapgen_setting("mg_name")
local snow_biomes = { local snow_biomes = {
"ColdTaiga_underground", "ColdTaiga_underground",
@ -63,11 +63,11 @@ local psdef= {
function mcl_weather.has_snow(pos) function mcl_weather.has_snow(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 false end
local bd = minetest.get_biome_data(pos) local bn = minetest.get_biome_name(minetest.get_biome_data(pos).biome)
local bn = minetest.get_biome_name(bd.biome) local bd = minetest.registered_biomes[bn]
if minetest.registered_biomes[bn]._mcl_biome_type == "snowy" then return true end if bd._mcl_biome_type == "snowy" then return true end
if minetest.registered_biomes[bn]._mcl_biome_type == "cold" then if bd._mcl_biome_type == "cold" then
if bn == "Taiga" and pos.y > 140 then return true end if bn == "Taiga" and pos.y > 140 then return true end
if bn == "MegaSpruceTaiga" and pos.y > 100 then return true end if bn == "MegaSpruceTaiga" and pos.y > 100 then return true end
end end