mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 20:03:45 +01:00
Fix crash when no group spawning positions found
This commit is contained in:
parent
489db73dca
commit
c1686923d3
@ -388,6 +388,10 @@ end
|
|||||||
|
|
||||||
local function spawn_group(p,mob,spawn_on,group_max)
|
local function spawn_group(p,mob,spawn_on,group_max)
|
||||||
local nn = minetest.find_nodes_in_area(vector.offset(p,-3,-3,-3),vector.offset(p,3,3,3),spawn_on)
|
local nn = minetest.find_nodes_in_area(vector.offset(p,-3,-3,-3),vector.offset(p,3,3,3),spawn_on)
|
||||||
|
if not nn or #nn < 1 then
|
||||||
|
nn = {}
|
||||||
|
table.insert(nn,p)
|
||||||
|
end
|
||||||
for i = 1, math.random(group_max) do
|
for i = 1, math.random(group_max) do
|
||||||
minetest.add_entity(nn[math.random(#nn)],mob)
|
minetest.add_entity(nn[math.random(#nn)],mob)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user