forked from VoxeLibre/VoxeLibre
Merge pull request 'Break infinite loop if unable to find any mob to spawn' (#1602) from jordan4ibanez/MineClone2:mineclone5 into mineclone5
Reviewed-on: MineClone2/MineClone2#1602
This commit is contained in:
commit
6b93978a22
|
@ -615,6 +615,12 @@ if mobs_spawn then
|
||||||
local repeat_mob_search = true
|
local repeat_mob_search = true
|
||||||
repeat
|
repeat
|
||||||
|
|
||||||
|
--do not infinite loop
|
||||||
|
if #mob_library_worker_table <= 0 then
|
||||||
|
--print("breaking infinite loop")
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
local skip = false
|
local skip = false
|
||||||
|
|
||||||
--use this for removing table elements of mobs that do not match
|
--use this for removing table elements of mobs that do not match
|
||||||
|
@ -659,12 +665,12 @@ if mobs_spawn then
|
||||||
|
|
||||||
--found a mob, exit out of loop
|
--found a mob, exit out of loop
|
||||||
if not skip then
|
if not skip then
|
||||||
minetest.log("warning", "found mob:"..temp_def.name)
|
--minetest.log("warning", "found mob:"..temp_def.name)
|
||||||
--print("found mob:"..temp_def.name)
|
--print("found mob:"..temp_def.name)
|
||||||
mob_def = table_copy(temp_def)
|
mob_def = table_copy(temp_def)
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
minetest.log("warning", "deleting temp index "..temp_index)
|
--minetest.log("warning", "deleting temp index "..temp_index)
|
||||||
--print("deleting temp index")
|
--print("deleting temp index")
|
||||||
table_remove(mob_library_worker_table, temp_index)
|
table_remove(mob_library_worker_table, temp_index)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue