commit
67c19e3ee8
1 changed files with 13 additions and 13 deletions
26
mapgen.lua
26
mapgen.lua
|
@ -103,23 +103,21 @@ end
|
||||||
-- end
|
-- end
|
||||||
--end
|
--end
|
||||||
|
|
||||||
fun_caves.is_fortress = function(pos, csize)
|
fun_caves.is_fortress = function(pos, cs)
|
||||||
local cs = csize
|
-- Fix this to get csize, somehow.
|
||||||
if not cs then
|
local cs = cs or {x=80, y=80, z=80}
|
||||||
-- Fix this to get csize, somehow.
|
|
||||||
cs = {x=80, y=80, z=80}
|
|
||||||
end
|
|
||||||
|
|
||||||
local x = math.floor((pos.x + 33) / cs.x)
|
|
||||||
local y = math.floor((pos.y + 33) / cs.y)
|
local y = math.floor((pos.y + 33) / cs.y)
|
||||||
local z = math.floor((pos.z + 33) / cs.z)
|
|
||||||
|
|
||||||
if y > -3 or (pos.y + 33) % cs.y > cs.y - 5 then
|
if y > -3 or (pos.y + 33) % cs.y > cs.y - 5 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local x = math.floor((pos.x + 33) / cs.x)
|
||||||
|
local z = math.floor((pos.z + 33) / cs.z)
|
||||||
|
|
||||||
local n = minetest.get_perlin(fortress_noise):get3d({x=x, y=y, z=z})
|
local n = minetest.get_perlin(fortress_noise):get3d({x=x, y=y, z=z})
|
||||||
n = (n * 10000) % 20
|
n = math.floor((n * 10000) % 20)
|
||||||
|
|
||||||
if n == 1 or DEBUG then
|
if n == 1 or DEBUG then
|
||||||
return true
|
return true
|
||||||
|
@ -250,10 +248,12 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Deal with memory issues. This, of course, is supposed to be automatic.
|
-- Deal with memory issues. This, of course, is supposed to be automatic.
|
||||||
if math.floor(collectgarbage("count")/1024) > 400 then
|
minetest.after(0, function()
|
||||||
print("Fun Caves: Manually collecting garbage...")
|
if math.floor(collectgarbage("count")/1024) > 400 then
|
||||||
collectgarbage("collect")
|
print("Fun Caves: Manually collecting garbage...")
|
||||||
end
|
collectgarbage("collect")
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue