From 2ad59c6df9e8e4f6960054275ba95239ac9dd723 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 18 Aug 2024 12:05:35 +0200 Subject: [PATCH] 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: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4386 Reviewed-by: the-real-herowl Co-authored-by: teknomunk Co-committed-by: teknomunk --- mods/ENVIRONMENT/mcl_weather/thunder.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mods/ENVIRONMENT/mcl_weather/thunder.lua b/mods/ENVIRONMENT/mcl_weather/thunder.lua index f8e5a0371..c594cde37 100644 --- a/mods/ENVIRONMENT/mcl_weather/thunder.lua +++ b/mods/ENVIRONMENT/mcl_weather/thunder.lua @@ -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