From 4a6f98636d8238adc4d2dd15531bdba9f23e6264 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 31 Jul 2022 05:24:23 +0200 Subject: [PATCH] fix crash in mapgen v6 --- mods/ENVIRONMENT/mcl_weather/rain.lua | 3 ++- mods/ENVIRONMENT/mcl_weather/snow.lua | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index dd8ff0b747..14f9d5dab6 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -44,7 +44,8 @@ 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 - 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 end diff --git a/mods/ENVIRONMENT/mcl_weather/snow.lua b/mods/ENVIRONMENT/mcl_weather/snow.lua index ac6dbb6ab3..57e0eba108 100644 --- a/mods/ENVIRONMENT/mcl_weather/snow.lua +++ b/mods/ENVIRONMENT/mcl_weather/snow.lua @@ -4,7 +4,7 @@ mcl_weather.snow = {} local PARTICLES_COUNT_SNOW = tonumber(minetest.settings:get("mcl_weather_snow_particles")) or 100 mcl_weather.snow.init_done = false -local mgname = minetest.get_mapgen_setting("mgname") +local mgname = minetest.get_mapgen_setting("mg_name") local snow_biomes = { "ColdTaiga_underground", @@ -63,11 +63,11 @@ local psdef= { function mcl_weather.has_snow(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 minetest.registered_biomes[bn]._mcl_biome_type == "snowy" then return true end - if minetest.registered_biomes[bn]._mcl_biome_type == "cold" then + if mgname == "singlenode" or mgname == "v6" then return false end + local bn = minetest.get_biome_name(minetest.get_biome_data(pos).biome) + local bd = minetest.registered_biomes[bn] + if bd._mcl_biome_type == "snowy" then return true end + if bd._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