Fix raid instawin when no spawnable blocks found

This commit is contained in:
cora 2022-11-17 05:47:48 +01:00
parent 057a78ed30
commit db4f9ec5a3
2 changed files with 6 additions and 1 deletions

@ -91,7 +91,10 @@ function check_events(dtime)
local p = ae:cond_progress() local p = ae:cond_progress()
if p == true then if p == true then
ae.stage = ae.stage + 1 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 elseif tonumber(p) then
ae.stage = tonumber(p) or ae.stage + 1 ae.stage = tonumber(p) or ae.stage + 1
ae:on_stage_begin() ae:on_stage_begin()

@ -187,12 +187,14 @@ function mcl_raids.spawn_raid(event)
mcl_raids.promote_to_raidcaptain(event.mobs[1]) mcl_raids.promote_to_raidcaptain(event.mobs[1])
end end
minetest.log("action", "[mcl_raids] Raid Spawned. Illager Count: " .. #event.mobs .. ".") minetest.log("action", "[mcl_raids] Raid Spawned. Illager Count: " .. #event.mobs .. ".")
return #event.mobs == 0
else else
minetest.log("action", "[mcl_raids] Raid Spawn Postion not chosen.") minetest.log("action", "[mcl_raids] Raid Spawn Postion not chosen.")
end end
elseif not sn then elseif not sn then
minetest.log("action", "[mcl_raids] Raid Spawn Position error, no appropriate site found.") minetest.log("action", "[mcl_raids] Raid Spawn Position error, no appropriate site found.")
end end
return true
end end
function mcl_raids.find_villager(pos) function mcl_raids.find_villager(pos)