Allow different sizes on each axis.
parent
e1ccd86490
commit
0e5fd71e59
146
mapgen.lua
146
mapgen.lua
|
@ -136,11 +136,11 @@ local function get_decoration(biome)
|
|||
end
|
||||
|
||||
|
||||
local pod_size = 100
|
||||
local half_pod = math.floor(pod_size / 2)
|
||||
local pod_size = {x=300, y=100, z=200}
|
||||
local half_pod = {x=math.floor(pod_size.x / 2), y=math.floor(pod_size.y / 2), z=math.floor(pod_size.z / 2)}
|
||||
local bridge_size = 50
|
||||
local fcsize = pod_size + bridge_size
|
||||
local bevel = half_pod
|
||||
local fcsize = {x=pod_size.x + bridge_size, y=pod_size.y + bridge_size, z=pod_size.z + bridge_size}
|
||||
local bevel = half_pod.y
|
||||
local room_size = 20
|
||||
local control_off = math.floor(room_size / 4)
|
||||
local biome_look = {}
|
||||
|
@ -173,14 +173,14 @@ local function place_schematic(pos, schem, center)
|
|||
elseif rot == 3 then
|
||||
x, z = z1, schem.size.x - x1 - 1
|
||||
end
|
||||
local fdz = (pos.z + z) % fcsize
|
||||
local fdx = (pos.x + x) % fcsize
|
||||
if fdz < pod_size - 1 and fdz > 0 and fdx < pod_size - 1 and fdx > 0 then
|
||||
local fdz = (pos.z + z) % fcsize.z
|
||||
local fdx = (pos.x + x) % fcsize.x
|
||||
if fdz < pod_size.z - 1 and fdz > 0 and fdx < pod_size.x - 1 and fdx > 0 then
|
||||
local ivm = a: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 fdy = (pos.y + y) % fcsize
|
||||
if math.min(fdx, pod_size - fdx) + math.min(fdy, pod_size - fdy) + math.min(fdz, pod_size - fdz) > bevel then
|
||||
local fdy = (pos.y + y) % fcsize.y
|
||||
if math.min(fdx, pod_size.x - fdx) + math.min(fdy, pod_size.y - fdy) + math.min(fdz, pod_size.z - fdz) > bevel then
|
||||
if yslice[y] or 255 >= math.random(255) then
|
||||
local prob = schem.data[isch].prob or schem.data[isch].param1 or 255
|
||||
if prob >= math.random(255) and schem.data[isch].name ~= "air" then
|
||||
|
@ -201,12 +201,11 @@ end
|
|||
|
||||
|
||||
local function get_biome(x, y, z)
|
||||
local px = math.floor(x / fcsize)
|
||||
local py = math.floor(y / fcsize)
|
||||
local pz = math.floor(z / fcsize)
|
||||
local px = math.floor(x / fcsize.x)
|
||||
local py = math.floor(y / fcsize.y)
|
||||
local pz = math.floor(z / fcsize.z)
|
||||
|
||||
if px % 10 == 6 and pz % 10 == 6 then
|
||||
print 'control'
|
||||
return "control"
|
||||
else
|
||||
local hash = px * 1000000 + py * 1000 + pz
|
||||
|
@ -228,14 +227,15 @@ local function get_biome(x, y, z)
|
|||
cave_look[hash] = cave_lining
|
||||
end
|
||||
|
||||
return biome_look[hash], cave_look[hash]
|
||||
return 'rainforest', cave_look[hash]
|
||||
--return biome_look[hash], cave_look[hash]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function get_height_old(dx, dz, terrain_scale, ocean, index)
|
||||
local terr
|
||||
local half = math.floor(csize.y / 2 + 0.5)
|
||||
local half = {x=math.floor(csize.x / 2 + 0.5), y=math.floor(csize.y / 2 + 0.5), z=math.floor(csize.z / 2 + 0.5)}
|
||||
terrain_scale = terrain_scale or 1
|
||||
|
||||
--if index == true then
|
||||
|
@ -252,7 +252,7 @@ local function get_height_old(dx, dz, terrain_scale, ocean, index)
|
|||
|
||||
terr = math.floor(terr * terrain_scale + 0.5)
|
||||
|
||||
local d = half - 2 - math.abs(math.abs(dx - (half - 0.5)) - math.abs(dz - (half - 0.5)))
|
||||
local d = half.y - 2 - math.abs(math.abs(dx - (half.x - 0.5)) - math.abs(dz - (half.z - 0.5)))
|
||||
if math.abs(terr) > d then
|
||||
if terr > 0 then
|
||||
terr = math.floor(d + 0.5)
|
||||
|
@ -265,7 +265,7 @@ local function get_height_old(dx, dz, terrain_scale, ocean, index)
|
|||
end
|
||||
|
||||
local function get_height(fdx, fdz, y, index, heights, terrain_scale, ocean)
|
||||
local py = math.floor(y / fcsize)
|
||||
local py = math.floor(y / fcsize.y)
|
||||
|
||||
if not terrain_scale then
|
||||
return
|
||||
|
@ -277,7 +277,13 @@ local function get_height(fdx, fdz, y, index, heights, terrain_scale, ocean)
|
|||
|
||||
local terr = math.floor(heights[py][index] * terrain_scale + 0.5)
|
||||
|
||||
local d = half_pod - 2 - math.abs(math.abs(fdx - (half_pod - 0.5)) - math.abs(fdz - (half_pod - 0.5)))
|
||||
local d = - math.abs(math.abs(fdx - (half_pod.x - 0.5)) - math.abs(fdz - (half_pod.z - 0.5)))
|
||||
if math.abs(fdx - half_pod.x) > math.abs(fdz - half_pod.z) then
|
||||
d = d + half_pod.x - 2
|
||||
else
|
||||
d = d + half_pod.z - 2
|
||||
end
|
||||
|
||||
if math.abs(terr) > d then
|
||||
if terr > 0 then
|
||||
terr = math.floor(d + 0.5)
|
||||
|
@ -301,7 +307,7 @@ local function generate(p_minp, p_maxp, seed)
|
|||
vm:set_lighting({day = 15, night = 0}, minp, maxp)
|
||||
lightmap = vm:get_light_data()
|
||||
|
||||
local ground = half_pod
|
||||
local ground = half_pod.y
|
||||
local heights = {}
|
||||
cloud = minetest.get_perlin_map(cloud_noise, csize):get2dMap_flat(minp)
|
||||
cave = minetest.get_perlin_map(cave_noise, csize):get3dMap_flat(minp)
|
||||
|
@ -310,18 +316,18 @@ local function generate(p_minp, p_maxp, seed)
|
|||
local index3d = 0
|
||||
for z = minp.z, maxp.z do
|
||||
local dz = z - minp.z
|
||||
local fdz = z % fcsize
|
||||
local fdz = z % fcsize.z
|
||||
for x = minp.x, maxp.x do
|
||||
index = index + 1
|
||||
local dx = x - minp.x
|
||||
local fdx = x % fcsize
|
||||
local fdx = x % fcsize.x
|
||||
local in_cave = false
|
||||
index3d = dz * csize.y * csize.x + dx + 1
|
||||
local ivm = a:index(x, minp.y, z)
|
||||
local cave_height = 0
|
||||
for y = minp.y, maxp.y do
|
||||
local dy = y - minp.y
|
||||
local fdy = y % fcsize
|
||||
local fdy = y % fcsize.y
|
||||
local biome, cave_lining = get_biome(x, y, z)
|
||||
local node_top = biomes[biome].node_top or "default:dirt_with_grass"
|
||||
local node_filler = biomes[biome].node_filler or "default:dirt"
|
||||
|
@ -335,60 +341,60 @@ local function generate(p_minp, p_maxp, seed)
|
|||
local swamp = string.find(biome, "swamp") and true or false
|
||||
local beach = string.find(biome, "beach") and true or false
|
||||
local dunes = string.find(biome, "dunes") and true or false
|
||||
local height = half_pod - 5
|
||||
local height = half_pod.y - 5
|
||||
if not (biome == "underground" or biome == 'control') then
|
||||
height = get_height(fdx, fdz, y, index, heights, biomes[biome].terrain_scale, ocean)
|
||||
end
|
||||
|
||||
if not (data[ivm] == node['air'] or data[ivm] == node['ignore']) then
|
||||
-- nop
|
||||
elseif biome == "control" and math.abs(fdx - half_pod) < 3 and math.abs(fdz - half_pod) < 3 then
|
||||
elseif biome == "control" and math.abs(fdx - half_pod.x) < 3 and math.abs(fdz - half_pod.z) < 3 then
|
||||
data[ivm] = node["loud_walking:air_ladder"]
|
||||
elseif fdz >= pod_size or fdx >= pod_size or fdy >= pod_size then
|
||||
if (fdy == half_pod and fdx == half_pod) or (fdy == half_pod and fdz == half_pod) then
|
||||
elseif fdz >= pod_size.z or fdx >= pod_size.x or fdy >= pod_size.y then
|
||||
if (fdy == half_pod.y and fdx == half_pod.x) or (fdy == half_pod.y and fdz == half_pod.z) then
|
||||
data[ivm] = node['loud_walking:scrith']
|
||||
else
|
||||
data[ivm] = node['air']
|
||||
end
|
||||
elseif math.min(fdx, pod_size - fdx) + math.min(fdy, pod_size - fdy) + math.min(fdz, pod_size - fdz) < bevel then
|
||||
elseif math.min(fdx, pod_size.x - fdx) + math.min(fdy, pod_size.y - fdy) + math.min(fdz, pod_size.z - fdz) < bevel then
|
||||
data[ivm] = node['air']
|
||||
lightmap[ivm] = 0
|
||||
in_cave = false
|
||||
elseif (fdx == 0 or fdx == pod_size - 1) or (fdz == 0 or fdz == pod_size - 1) or (fdy == 0 or fdy == pod_size - 1) or math.min(fdx, pod_size - fdx) + math.min(fdy, pod_size - fdy) + math.min(fdz, pod_size - fdz) < bevel + 1 then
|
||||
if math.abs(fdy - half_pod - 2) < 2 and (fdz == half_pod or fdx == half_pod) then
|
||||
elseif (fdx == 0 or fdx == pod_size.x - 1) or (fdz == 0 or fdz == pod_size.z - 1) or (fdy == 0 or fdy == pod_size.y - 1) or math.min(fdx, pod_size.x - fdx) + math.min(fdy, pod_size.y - fdy) + math.min(fdz, pod_size.z - fdz) < bevel + 1 then
|
||||
if math.abs(fdy - half_pod.y - 2) < 2 and (fdz == half_pod.z or fdx == half_pod.x) then
|
||||
data[ivm] = node["air"]
|
||||
else
|
||||
if biome == "control" then
|
||||
data[ivm] = node[glass[3]]
|
||||
elseif fdy < half_pod then
|
||||
elseif fdy < half_pod.y then
|
||||
data[ivm] = node["loud_walking:scrith"]
|
||||
lightmap[ivm] = 0
|
||||
elseif biome == "underground" then
|
||||
data[ivm] = node["loud_walking:scrith"]
|
||||
lightmap[ivm] = 0
|
||||
elseif fdy == pod_size - 1 then
|
||||
elseif fdy == pod_size.y - 1 then
|
||||
data[ivm] = node[glass[cloud[index] < cloud_i and 1 or 2]]
|
||||
else
|
||||
data[ivm] = node[glass[1]]
|
||||
end
|
||||
end
|
||||
elseif fdz == 0 and fdz == pod_size - 1 or fdx == 0 and fdx == pod_size - 1 or fdy == 0 and fdy == pod_size - 1 then
|
||||
elseif fdz == 0 and fdz == pod_size.z - 1 or fdx == 0 and fdx == pod_size.x - 1 or fdy == 0 and fdy == pod_size.y - 1 then
|
||||
data[ivm] = node['loud_walking:scrith']
|
||||
elseif biome == "control" and fdy % 5 == 0 then
|
||||
data[ivm] = node["loud_walking:control_floor"]
|
||||
elseif biome == "control" and (math.abs(fdx - half_pod) < 3 or math.abs(fdz - half_pod) < 3) then
|
||||
elseif biome == "control" and (math.abs(fdx - half_pod.x) < 3 or math.abs(fdz - half_pod.z) < 3) then
|
||||
data[ivm] = node["air"]
|
||||
elseif biome == "control" and ((math.abs(fdx - half_pod) % room_size == 3 and (math.abs(fdz - half_pod) - 12) % room_size > 3) or (math.abs(fdz - half_pod) % room_size == 3 and (math.abs(fdx - half_pod) - 12) % room_size > 3)) then
|
||||
elseif biome == "control" and ((math.abs(fdx - half_pod.x) % room_size == 3 and (math.abs(fdz - half_pod.z) - 12) % room_size > 3) or (math.abs(fdz - half_pod.z) % room_size == 3 and (math.abs(fdx - half_pod.x) - 12) % room_size > 3)) then
|
||||
data[ivm] = node["loud_walking:control_wall"]
|
||||
elseif biome == "control" then
|
||||
--
|
||||
elseif (((fdx == (half_pod - control_off) or fdx == (half_pod + control_off)) and fdz >= (half_pod - control_off) and fdz <= (half_pod + control_off)) or ((fdz == (half_pod - control_off) or fdz == (half_pod + control_off)) and fdx >= (half_pod - control_off) and fdx <= (half_pod + control_off))) and fdx ~= half_pod and fdz ~= half_pod and fdy == pod_size - 2 then
|
||||
elseif (((fdx == (half_pod.x - control_off) or fdx == (half_pod.x + control_off)) and fdz >= (half_pod.z - control_off) and fdz <= (half_pod.z + control_off)) or ((fdz == (half_pod.z - control_off) or fdz == (half_pod.z + control_off)) and fdx >= (half_pod.x - control_off) and fdx <= (half_pod.x + control_off))) and fdx ~= half_pod.x and fdz ~= half_pod.z and fdy == pod_size.y - 2 then
|
||||
data[ivm] = node["loud_walking:controls"]
|
||||
elseif (((fdx == (half_pod - control_off) or fdx == (half_pod + control_off)) and fdz >= (half_pod - control_off) and fdz <= (half_pod + control_off)) or ((fdz == (half_pod - control_off) or fdz == (half_pod + control_off)) and fdx >= (half_pod - control_off) and fdx <= (half_pod + control_off))) and fdx ~= half_pod and fdz ~= half_pod and fdy > pod_size - control_off then
|
||||
elseif (((fdx == (half_pod.x - control_off) or fdx == (half_pod.x + control_off)) and fdz >= (half_pod.z - control_off) and fdz <= (half_pod.z + control_off)) or ((fdz == (half_pod.z - control_off) or fdz == (half_pod.z + control_off)) and fdx >= (half_pod.x - control_off) and fdx <= (half_pod.x + control_off))) and fdx ~= half_pod.x and fdz ~= half_pod.z and fdy > pod_size.y - control_off then
|
||||
data[ivm] = node[glass[3]]
|
||||
elseif fdz >= (half_pod - control_off) and fdz <= (half_pod + control_off) and fdx >= (half_pod - control_off) and fdx <= (half_pod + control_off) and fdy == pod_size - control_off then
|
||||
elseif fdz >= (half_pod.z - control_off) and fdz <= (half_pod.z + control_off) and fdx >= (half_pod.x - control_off) and fdx <= (half_pod.x + control_off) and fdy == pod_size.y - control_off then
|
||||
data[ivm] = node[glass[3]]
|
||||
elseif not in_cave and (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod and fdy == height + ground + 1 then
|
||||
elseif not in_cave and (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod.y and fdy == height + ground + 1 then
|
||||
-- ** water decorations **
|
||||
--local deco = get_decoration(biome)
|
||||
--if deco then
|
||||
|
@ -399,16 +405,16 @@ local function generate(p_minp, p_maxp, seed)
|
|||
if deco then
|
||||
data[ivm] = node[deco]
|
||||
end
|
||||
elseif (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod and fdy >= half_pod - depth_water_top then
|
||||
elseif (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod.y and fdy >= half_pod.y - depth_water_top then
|
||||
data[ivm] = node[node_water_top]
|
||||
in_cave = false
|
||||
elseif (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod then
|
||||
elseif (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod.y then
|
||||
data[ivm] = node[node_water]
|
||||
in_cave = false
|
||||
elseif fdy > height + ground then
|
||||
data[ivm] = node["air"]
|
||||
in_cave = false
|
||||
elseif cave[index3d] ^ 2 > (biome == "underground" and 0.5 or 1.3 - math.sin(fdy / (half_pod * 0.2))) then
|
||||
elseif cave[index3d] ^ 2 > (biome == "underground" and 0.5 or 1.3 - math.sin(fdy / (half_pod.y * 0.2))) then
|
||||
cave_height = cave_height + 1
|
||||
if height + ground >= fdy and not in_cave and fdy > height + ground - 10 then
|
||||
data[ivm] = node[node_top]
|
||||
|
@ -418,9 +424,9 @@ local function generate(p_minp, p_maxp, seed)
|
|||
elseif ocean or swamp or beach then
|
||||
data[ivm] = node[node_filler]
|
||||
end
|
||||
elseif (ocean or swamp or beach) and not in_cave and node_stone == "default:stone" and fdy < half_pod and math.random(20) == 1 then
|
||||
elseif (ocean or swamp or beach) and not in_cave and node_stone == "default:stone" and fdy < half_pod.y and math.random(20) == 1 then
|
||||
data[ivm] = node["loud_walking:glowing_fungal_stone"]
|
||||
elseif (ocean or swamp or beach) and fdy < half_pod then
|
||||
elseif (ocean or swamp or beach) and fdy < half_pod.y then
|
||||
data[ivm] = node[node_water]
|
||||
elseif cave_height == 3 and node_filler == "default:dirt" and mushroom_stones[data[ivm - 3 * a.ystride]] and math.random(40) == 1 then
|
||||
data[ivm] = node["loud_walking:giant_mushroom_cap"]
|
||||
|
@ -440,7 +446,7 @@ local function generate(p_minp, p_maxp, seed)
|
|||
end
|
||||
in_cave = true
|
||||
--lightmap[ivm] = 0
|
||||
elseif cave_lining and cave[index3d] ^ 2 > (biome == "underground" and 0.4 or 1.2 - math.sin(fdy / (half_pod * 0.2))) then
|
||||
elseif cave_lining and cave[index3d] ^ 2 > (biome == "underground" and 0.4 or 1.2 - math.sin(fdy / (half_pod.y * 0.2))) then
|
||||
data[ivm] = node[cave_lining]
|
||||
lightmap[ivm] = 0
|
||||
elseif fdy > height + ground - depth_top then
|
||||
|
@ -476,15 +482,15 @@ local function generate(p_minp, p_maxp, seed)
|
|||
|
||||
local index = 0
|
||||
for z = minp.z, maxp.z do
|
||||
local fdz = z % fcsize
|
||||
local fdz = z % fcsize.z
|
||||
for x = minp.x, maxp.x do
|
||||
local fdx = x % fcsize
|
||||
local fdx = x % fcsize.x
|
||||
index = index + 1
|
||||
for y = minp.y, maxp.y do
|
||||
local fdy = y % fcsize
|
||||
local fdy = y % fcsize.y
|
||||
if fdz % 5 == 0 and fdx % 5 == 0 then
|
||||
local fdy = y % fcsize
|
||||
local pod = fdz < pod_size and fdx < pod_size and fdy < pod_size
|
||||
local fdy = y % fcsize.y
|
||||
local pod = fdz < pod_size.z and fdx < pod_size.x and fdy < pod_size.y
|
||||
local biome, cave_lining = get_biome(x, y, z)
|
||||
local ocean = string.find(biome, "ocean") and true or false
|
||||
local height = get_height(fdx, fdz, y, index, heights, biomes[biome].terrain_scale, ocean)
|
||||
|
@ -623,8 +629,8 @@ local function generate_old(p_minp, p_maxp, seed)
|
|||
local swamp = string.find(biome, "swamp") and true or false
|
||||
local beach = string.find(biome, "beach") and true or false
|
||||
local dunes = string.find(biome, "dunes") and true or false
|
||||
local half = math.floor(csize.y / 2 + 0.5)
|
||||
local ground = half
|
||||
local half = {x=math.floor(csize.x / 2 + 0.5), y=math.floor(csize.y / 2 + 0.5), z=math.floor(csize.z / 2 + 0.5)}
|
||||
local ground = half.y
|
||||
|
||||
beach = beach or dunes
|
||||
if ocean then
|
||||
|
@ -653,26 +659,26 @@ local function generate_old(p_minp, p_maxp, seed)
|
|||
local terr = get_height(dx, dz, biomes[biome].terrain_scale, ocean, index)
|
||||
local in_cave = false
|
||||
if biome == "underground" then
|
||||
terr = half - 5
|
||||
terr = half.y - 5
|
||||
end
|
||||
|
||||
local cave_height = 0
|
||||
for y = minp.y, maxp.y do
|
||||
local dy = y - minp.y
|
||||
if pod then
|
||||
if biome == "control" and math.abs(dx - half) < 3 and math.abs(dz - half) < 3 then
|
||||
if biome == "control" and math.abs(dx - half.x) < 3 and math.abs(dz - half.z) < 3 then
|
||||
data[ivm] = node["loud_walking:air_ladder"]
|
||||
elseif math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) < bevel then
|
||||
data[ivm] = node["air"]
|
||||
lightmap[ivm] = 0
|
||||
in_cave = false
|
||||
elseif (dx == 0 or dx == csize.x - 1) or (dz == 0 or dz == csize.z - 1) or (dy == 0 or dy == csize.y - 1) or math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) < bevel + 1 then
|
||||
if math.abs(dy - half - 2) < 2 and (dz == half or dx == half) then
|
||||
if math.abs(dy - half.y - 2) < 2 and (dz == half.z or dx == half.x) then
|
||||
data[ivm] = node["air"]
|
||||
else
|
||||
if biome == "control" then
|
||||
data[ivm] = node[glass[3]]
|
||||
elseif dy < half then
|
||||
elseif dy < half.y then
|
||||
data[ivm] = node["loud_walking:scrith"]
|
||||
lightmap[ivm] = 0
|
||||
elseif biome == "underground" then
|
||||
|
@ -687,9 +693,9 @@ local function generate_old(p_minp, p_maxp, seed)
|
|||
in_cave = false
|
||||
elseif biome == "control" and dy % 5 == 0 then
|
||||
data[ivm] = node["loud_walking:control_floor"]
|
||||
elseif biome == "control" and (math.abs(dx - half) < 3 or math.abs(dz - half) < 3) then
|
||||
elseif biome == "control" and (math.abs(dx - half.x) < 3 or math.abs(dz - half.z) < 3) then
|
||||
data[ivm] = node["air"]
|
||||
elseif biome == "control" and ((math.abs(dx - half) % 20 == 3 and (math.abs(dz - half) - 12) % 20 > 3) or (math.abs(dz - half) % 20 == 3 and (math.abs(dx - half) - 12) % 20 > 3)) then
|
||||
elseif biome == "control" and ((math.abs(dx - half.x) % 20 == 3 and (math.abs(dz - half.z) - 12) % 20 > 3) or (math.abs(dz - half.z) % 20 == 3 and (math.abs(dx - half.x) - 12) % 20 > 3)) then
|
||||
data[ivm] = node["loud_walking:control_wall"]
|
||||
elseif biome == "control" then
|
||||
--
|
||||
|
@ -699,7 +705,7 @@ local function generate_old(p_minp, p_maxp, seed)
|
|||
data[ivm] = node[glass[3]]
|
||||
elseif dz >= 35 and dz <= 45 and dx >= 35 and dx <= 45 and dy == csize.y - 5 then
|
||||
data[ivm] = node[glass[3]]
|
||||
elseif not in_cave and (ocean or swamp or beach) and dy > terr + ground and dy <= half and dy == terr + ground + 1 then
|
||||
elseif not in_cave and (ocean or swamp or beach) and dy > terr + ground and dy <= half.y and dy == terr + ground + 1 then
|
||||
-- ** water decorations **
|
||||
--local deco = get_decoration(biome)
|
||||
--if deco then
|
||||
|
@ -710,16 +716,16 @@ local function generate_old(p_minp, p_maxp, seed)
|
|||
if deco then
|
||||
data[ivm] = node[deco]
|
||||
end
|
||||
elseif (ocean or swamp or beach) and dy > terr + ground and dy <= half and dy >= half - depth_water_top then
|
||||
elseif (ocean or swamp or beach) and dy > terr + ground and dy <= half.y and dy >= half.y - depth_water_top then
|
||||
data[ivm] = node[node_water_top]
|
||||
in_cave = false
|
||||
elseif (ocean or swamp or beach) and dy > terr + ground and dy <= half then
|
||||
elseif (ocean or swamp or beach) and dy > terr + ground and dy <= half.y then
|
||||
data[ivm] = node[node_water]
|
||||
in_cave = false
|
||||
elseif dy > terr + ground then
|
||||
data[ivm] = node["air"]
|
||||
in_cave = false
|
||||
elseif cave[index3d] ^ 2 > (biome == "underground" and 0.5 or 1.3 - math.sin(dy / (half * 0.2))) then
|
||||
elseif cave[index3d] ^ 2 > (biome == "underground" and 0.5 or 1.3 - math.sin(dy / (half.y * 0.2))) then
|
||||
cave_height = cave_height + 1
|
||||
if terr + ground >= dy and not in_cave and dy > terr + ground - 10 then
|
||||
data[ivm] = node[node_top]
|
||||
|
@ -729,9 +735,9 @@ local function generate_old(p_minp, p_maxp, seed)
|
|||
elseif ocean or swamp or beach then
|
||||
data[ivm] = node[node_filler]
|
||||
end
|
||||
elseif (ocean or swamp or beach) and not in_cave and node_stone == "default:stone" and dy < half and math.random(20) == 1 then
|
||||
elseif (ocean or swamp or beach) and not in_cave and node_stone == "default:stone" and dy < half.y and math.random(20) == 1 then
|
||||
data[ivm] = node["loud_walking:glowing_fungal_stone"]
|
||||
elseif (ocean or swamp or beach) and dy < half then
|
||||
elseif (ocean or swamp or beach) and dy < half.y then
|
||||
data[ivm] = node[node_water]
|
||||
elseif cave_height == 3 and node_filler == "default:dirt" and mushroom_stones[data[ivm - 3 * a.ystride]] and math.random(40) == 1 then
|
||||
data[ivm] = node["loud_walking:giant_mushroom_cap"]
|
||||
|
@ -751,7 +757,7 @@ local function generate_old(p_minp, p_maxp, seed)
|
|||
end
|
||||
in_cave = true
|
||||
lightmap[ivm] = 0
|
||||
elseif cave_lining and cave[index3d] ^ 2 > (biome == "underground" and 0.4 or 1.2 - math.sin(dy / (half * 0.2))) then
|
||||
elseif cave_lining and cave[index3d] ^ 2 > (biome == "underground" and 0.4 or 1.2 - math.sin(dy / (half.y * 0.2))) then
|
||||
data[ivm] = node[cave_lining]
|
||||
lightmap[ivm] = 0
|
||||
elseif dy > terr + ground - depth_top then
|
||||
|
@ -774,9 +780,9 @@ local function generate_old(p_minp, p_maxp, seed)
|
|||
lightmap[ivm] = 0
|
||||
in_cave = false
|
||||
end
|
||||
elseif biome == "control" and math.abs(dx - half) < 3 and math.abs(dz - half) < 3 then
|
||||
elseif biome == "control" and math.abs(dx - half.x) < 3 and math.abs(dz - half.z) < 3 then
|
||||
data[ivm] = node["loud_walking:air_ladder"]
|
||||
elseif connection and dy == half and ((dx == half and connection % 4 == 0) or (dz == half and connection % 2 == 1)) then
|
||||
elseif connection and dy == half.y and ((dx == half.x and connection % 4 == 0) or (dz == half.z and connection % 2 == 1)) then
|
||||
data[ivm] = node["loud_walking:scrith"]
|
||||
lightmap[ivm] = 0
|
||||
end
|
||||
|
@ -799,7 +805,7 @@ local function generate_old(p_minp, p_maxp, seed)
|
|||
local y = minp.y + get_height(x - minp.x, z - minp.z, biomes[biome].terrain_scale, ocean) + ground
|
||||
|
||||
local ivm = a:index(x, y, z)
|
||||
if (swamp or data[ivm + a.ystride] ~= node["default:water_source"]) and (data[ivm] == node[node_top]) then
|
||||
if y >= minp.y and y <= maxp.y and (swamp or data[ivm + a.ystride] ~= node["default:water_source"]) and (data[ivm] == node[node_top]) then
|
||||
if biomes[biome].special_trees then
|
||||
local tree_type = biomes[biome].special_trees[math.random(#biomes[biome].special_trees)]
|
||||
if tree_type and loud_walking.schematics then
|
||||
|
@ -906,9 +912,9 @@ function loud_walking.respawn(player)
|
|||
while true do
|
||||
local px = math.random(-10, 10) * 2 - 1
|
||||
local pz = math.random(-10, 10) * 2
|
||||
local x = pod_size * px
|
||||
local z = pod_size * pz
|
||||
local y = half_pod + 1
|
||||
local x = pod_size.x * px
|
||||
local z = pod_size.z * pz
|
||||
local y = half_pod.y + 1
|
||||
|
||||
local pos = {x=x,y=y,z=z}
|
||||
local node = minetest.get_node(pos)
|
||||
|
|
Loading…
Reference in New Issue