diff --git a/mods/ENVIRONMENT/mcl_weather/weather_core.lua b/mods/ENVIRONMENT/mcl_weather/weather_core.lua index f7316bcfb..ec19b8549 100644 --- a/mods/ENVIRONMENT/mcl_weather/weather_core.lua +++ b/mods/ENVIRONMENT/mcl_weather/weather_core.lua @@ -100,7 +100,35 @@ end function mcl_weather.is_outdoor(pos) local cpos = {x=pos.x, y=pos.y+1, z=pos.z} local dim = mcl_worlds.pos_to_dimension(cpos) - if minetest.get_node_light(cpos, 0.5) == 15 and dim == "overworld" then + + local probe_is_outdoors = function () + -- Place probes in a square around the player just above their head. + local probe_distance = { + x = 7, + y = 1, + z = 7 + } + + local probe_offsets = { -1, 0, 1 } + for _, x in ipairs(probe_offsets) do + for _, z in ipairs(probe_offsets) do + local probe_pos = { + x = cpos.x + x * probe_distance.x, + y = cpos.y + probe_distance.y, + z = cpos.z + z * probe_distance.z + } + + local light = minetest.get_node_light(probe_pos, 0.5) + if light ~= nil and light == 15 then + return true + end + end + end + return false + end + + -- If at least one probe is "outdoors", the player is considered outdoors. + if probe_is_outdoors() and dim == "overworld" then return true end return false