Add flora and fauna to clouds.
This commit is contained in:
parent
b5d48307cb
commit
30d5f9ce96
13 changed files with 316 additions and 100 deletions
74
mapgen.lua
74
mapgen.lua
|
@ -74,6 +74,78 @@ fun_caves.is_fortress = function(pos, cs, debug)
|
|||
return false
|
||||
end
|
||||
|
||||
fun_caves.place_schematic = function(minp, maxp, data, p2data, area, node, pos, schem, center)
|
||||
local rot = rand(4) - 1
|
||||
local yslice = {}
|
||||
if schem.yslice_prob then
|
||||
for _, ys in pairs(schem.yslice_prob) do
|
||||
yslice[ys.ypos] = ys.prob
|
||||
end
|
||||
end
|
||||
|
||||
if center then
|
||||
pos.x = pos.x - floor(schem.size.x / 2)
|
||||
pos.z = pos.z - floor(schem.size.z / 2)
|
||||
end
|
||||
|
||||
for z1 = 0, schem.size.z - 1 do
|
||||
for x1 = 0, schem.size.x - 1 do
|
||||
local x, z
|
||||
if rot == 0 then
|
||||
x, z = x1, z1
|
||||
elseif rot == 1 then
|
||||
x, z = schem.size.z - z1 - 1, x1
|
||||
elseif rot == 2 then
|
||||
x, z = schem.size.x - x1 - 1, schem.size.z - z1 - 1
|
||||
elseif rot == 3 then
|
||||
x, z = z1, schem.size.x - x1 - 1
|
||||
end
|
||||
local dz = pos.z - minp.z + z
|
||||
local dx = pos.x - minp.x + x
|
||||
if pos.x + x > minp.x and pos.x + x < maxp.x and pos.z + z > minp.z and pos.z + z < maxp.z then
|
||||
local ivm = area:index(pos.x + x, pos.y, pos.z + z)
|
||||
local isch = z1 * schem.size.y * schem.size.x + x1 + 1
|
||||
for y = 0, schem.size.y - 1 do
|
||||
local dy = pos.y - minp.y + y
|
||||
--if math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) > bevel then
|
||||
if yslice[y] or 255 >= rand(255) then
|
||||
local prob = schem.data[isch].prob or schem.data[isch].param1 or 255
|
||||
if prob >= rand(255) and schem.data[isch].name ~= "air" then
|
||||
data[ivm] = node[schem.data[isch].name]
|
||||
end
|
||||
local param2 = schem.data[isch].param2 or 0
|
||||
p2data[ivm] = param2
|
||||
end
|
||||
--end
|
||||
|
||||
ivm = ivm + area.ystride
|
||||
isch = isch + schem.size.x
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
fun_caves.surround = function(node, data, area, ivm)
|
||||
-- Check to make sure that a plant root is fully surrounded.
|
||||
-- This is due to the kludgy way you have to make water plants
|
||||
-- in minetest, to avoid bubbles.
|
||||
for x1 = -1,1,2 do
|
||||
local n = data[ivm+x1]
|
||||
if n == node["default:river_water_source"] or n == node["default:water_source"] or n == node["air"] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
for z1 = -area.zstride,area.zstride,2*area.zstride do
|
||||
local n = data[ivm+z1]
|
||||
if n == node["default:river_water_source"] or n == node["default:water_source"] or n == node["air"] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
fun_caves.underzones = {
|
||||
Caina = {
|
||||
|
@ -303,7 +375,7 @@ local function generate(p_minp, p_maxp, seed)
|
|||
end
|
||||
|
||||
if minp.y > 3000 then
|
||||
write = fun_caves.cloudgen(minp, maxp, data, area, node)
|
||||
write = fun_caves.cloudgen(minp, maxp, data, p2data, area, node)
|
||||
elseif not underzone and fun_caves.is_fortress(minp, csize) then
|
||||
--if not underzone then
|
||||
fun_caves.fortress(minp, maxp, data, area, node)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue