Stop lightning striking positions that don't have rain (#4386)

Stops lighting from being able to strike in locations where rain doesn't occur, but allows lightning in adjacent areas where is allowed.

Reviewed-on: VoxeLibre/VoxeLibre#4386
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: teknomunk <teknomunk@protonmail.com>
Co-committed-by: teknomunk <teknomunk@protonmail.com>
This commit is contained in:
teknomunk 2024-08-18 12:05:35 +02:00 committed by the-real-herowl
parent 948da34755
commit 2ad59c6df9
1 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,10 @@ mcl_weather.thunder = {
init_done = false,
}
lightning.register_on_strike(function(pos, pos2, objects)
if not mcl_weather.has_rain(pos) then return nil, true end
end)
minetest.register_globalstep(function(dtime)
if mcl_weather.get_weather() ~= "thunder" then
return false