Fix crash when populating dungeons near 0 0 0
parent
f23fc8fb8c
commit
e8fde86a19
|
@ -111,8 +111,16 @@ minetest.register_on_generated( function (minp, maxp, blockseed)
|
|||
local numgoblins = 2 + ( ((xsize * 2) * (zsize * 2)) * fillratio )
|
||||
|
||||
for e=1,numgoblins do
|
||||
local rx = math.random((center.x-(xsize-1)),(center.x+(xsize-1)))
|
||||
local rz = math.random((center.z-(zsize-1)),(center.z+(zsize-1)))
|
||||
local x1 = (center.x-(xsize-1))
|
||||
local x2 = (center.x+(xsize-1))
|
||||
if x1 > x2 then break end
|
||||
local rx = math.random(x1,x2)
|
||||
|
||||
local z1 = (center.z-(zsize-1))
|
||||
local z2 = (center.z+(zsize-1))
|
||||
if z1 > z2 then break end
|
||||
local rz = math.random(z1,z2)
|
||||
|
||||
local s = {mob="mobs:goblin",pos={x=rx,z=rz,y=(center.y+1)}}
|
||||
table.insert(spawn,s)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue