From db4f9ec5a3558d4071488a08b6e95227a7d1a2f8 Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 17 Nov 2022 05:47:48 +0100 Subject: [PATCH] Fix raid instawin when no spawnable blocks found --- mods/CORE/mcl_events/init.lua | 5 ++++- mods/ENVIRONMENT/mcl_raids/init.lua | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/CORE/mcl_events/init.lua b/mods/CORE/mcl_events/init.lua index 1e278d80f..1d2fcfb35 100644 --- a/mods/CORE/mcl_events/init.lua +++ b/mods/CORE/mcl_events/init.lua @@ -91,7 +91,10 @@ function check_events(dtime) local p = ae:cond_progress() if p == true then ae.stage = ae.stage + 1 - ae:on_stage_begin() + if ae:on_stage_begin() == true then + mcl_log("[mcl_events] Event "..ae.readable_name.." at "..minetest.pos_to_string(vector.round(ae.pos)).." failed at stage_begin of stage "..ae.stage ) + active_events[idx] = nil + end elseif tonumber(p) then ae.stage = tonumber(p) or ae.stage + 1 ae:on_stage_begin() diff --git a/mods/ENVIRONMENT/mcl_raids/init.lua b/mods/ENVIRONMENT/mcl_raids/init.lua index 4918b6059..4986ef082 100644 --- a/mods/ENVIRONMENT/mcl_raids/init.lua +++ b/mods/ENVIRONMENT/mcl_raids/init.lua @@ -187,12 +187,14 @@ function mcl_raids.spawn_raid(event) mcl_raids.promote_to_raidcaptain(event.mobs[1]) end minetest.log("action", "[mcl_raids] Raid Spawned. Illager Count: " .. #event.mobs .. ".") + return #event.mobs == 0 else minetest.log("action", "[mcl_raids] Raid Spawn Postion not chosen.") end elseif not sn then minetest.log("action", "[mcl_raids] Raid Spawn Position error, no appropriate site found.") end + return true end function mcl_raids.find_villager(pos)