forked from VoxeLibre/VoxeLibre
Merge pull request 'Fix crash when no group spawning positions found (#2410)' (#2412) from fix_group_spawn_crash into master
Reviewed-on: MineClone2/MineClone2#2412 Reviewed-by: MysticTempest <mystictempest@noreply.git.minetest.land>
This commit is contained in:
commit
df2934c548
|
@ -388,6 +388,10 @@ end
|
|||
|
||||
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)
|
||||
if not nn or #nn < 1 then
|
||||
nn = {}
|
||||
table.insert(nn,p)
|
||||
end
|
||||
for i = 1, math.random(group_max) do
|
||||
minetest.add_entity(nn[math.random(#nn)],mob)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue