Add another depth check.
parent
4dc9334927
commit
a6b847bb75
566
terrain.lua
566
terrain.lua
|
@ -53,22 +53,22 @@ loud_walking.bevel = bevel
|
||||||
|
|
||||||
|
|
||||||
local function connection(x, y, z)
|
local function connection(x, y, z)
|
||||||
local min_x = math_floor((x + 32) / csize.x)
|
local min_x = math_floor((x + 32) / csize.x)
|
||||||
local min_y = math_floor((y + 32) / csize.y)
|
local min_y = math_floor((y + 32) / csize.y)
|
||||||
local min_z = math_floor((z + 32) / csize.z)
|
local min_z = math_floor((z + 32) / csize.z)
|
||||||
|
|
||||||
--local seed_noise = minetest.get_perlin({offset = 0, scale = 32768,
|
--local seed_noise = minetest.get_perlin({offset = 0, scale = 32768,
|
||||||
--seed = 5202, spread = {x = 80, y = 80, z = 80}, octaves = 2,
|
--seed = 5202, spread = {x = 80, y = 80, z = 80}, octaves = 2,
|
||||||
--persist = 0.4, lacunarity = 2})
|
--persist = 0.4, lacunarity = 2})
|
||||||
--math.randomseed(seed_noise:get2d({x=minp.x, y=minp.z}))
|
--math.randomseed(seed_noise:get2d({x=minp.x, y=minp.z}))
|
||||||
|
|
||||||
local ct = min_x % 2 + min_y % 2 + min_z % 2
|
local ct = min_x % 2 + min_y % 2 + min_z % 2
|
||||||
local r = min_x % 2 + 2 * (min_y % 2) + 4 * (min_z % 2)
|
local r = min_x % 2 + 2 * (min_y % 2) + 4 * (min_z % 2)
|
||||||
if ct == 1 then
|
if ct == 1 then
|
||||||
return r
|
return r
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,10 +91,10 @@ end
|
||||||
|
|
||||||
local cave_stones = {
|
local cave_stones = {
|
||||||
'default:stone',
|
'default:stone',
|
||||||
--"loud_walking:stone_with_moss",
|
--"loud_walking:stone_with_moss",
|
||||||
--"loud_walking:stone_with_lichen",
|
--"loud_walking:stone_with_lichen",
|
||||||
--"loud_walking:stone_with_algae",
|
--"loud_walking:stone_with_algae",
|
||||||
--"loud_walking:stone_with_salt",
|
--"loud_walking:stone_with_salt",
|
||||||
}
|
}
|
||||||
|
|
||||||
local mushroom_stones = {
|
local mushroom_stones = {
|
||||||
|
@ -102,51 +102,51 @@ local mushroom_stones = {
|
||||||
|
|
||||||
|
|
||||||
local function get_biome(x, y, z)
|
local function get_biome(x, y, z)
|
||||||
local px = math_floor(x / fcsize.x)
|
local px = math_floor(x / fcsize.x)
|
||||||
local pz = math_floor(z / fcsize.z)
|
local pz = math_floor(z / fcsize.z)
|
||||||
|
|
||||||
if px % 10 == 6 and pz % 10 == 6 then
|
if px % 10 == 6 and pz % 10 == 6 then
|
||||||
return "control"
|
return "control"
|
||||||
else
|
else
|
||||||
local hash = px * 1000 + pz
|
local hash = px * 1000 + pz
|
||||||
if not biome_look[hash] then
|
if not biome_look[hash] then
|
||||||
-- use the same seed (based on perlin noise).
|
-- use the same seed (based on perlin noise).
|
||||||
local seed_noise = minetest.get_perlin({offset = 0, scale = 32768, seed = 5202, spread = {x = 80, y = 80, z = 80}, octaves = 2, persist = 0.4, lacunarity = 2})
|
local seed_noise = minetest.get_perlin({offset = 0, scale = 32768, seed = 5202, spread = {x = 80, y = 80, z = 80}, octaves = 2, persist = 0.4, lacunarity = 2})
|
||||||
math.randomseed(seed_noise:get2d({x=px, y=pz}))
|
math.randomseed(seed_noise:get2d({x=px, y=pz}))
|
||||||
|
|
||||||
local rarity = "common"
|
local rarity = "common"
|
||||||
if math.random(5) == 1 then
|
if math.random(5) == 1 then
|
||||||
rarity = "uncommon"
|
rarity = "uncommon"
|
||||||
end
|
end
|
||||||
biome_look[hash] = biome_names[rarity][math.random(#loud_walking.biome_names[rarity])]
|
biome_look[hash] = biome_names[rarity][math.random(#loud_walking.biome_names[rarity])]
|
||||||
|
|
||||||
local cave_lining
|
local cave_lining
|
||||||
if math.random(3) ~= 1 then
|
if math.random(3) ~= 1 then
|
||||||
cave_lining = cave_stones[math.random(#cave_stones)]
|
cave_lining = cave_stones[math.random(#cave_stones)]
|
||||||
end
|
end
|
||||||
cave_look[hash] = cave_lining
|
cave_look[hash] = cave_lining
|
||||||
|
|
||||||
local sr = math.random(100)
|
local sr = math.random(100)
|
||||||
if sr == 1 then
|
if sr == 1 then
|
||||||
ore_look[hash] = 'default:stone_with_mese'
|
ore_look[hash] = 'default:stone_with_mese'
|
||||||
elseif sr <= 3 then
|
elseif sr <= 3 then
|
||||||
ore_look[hash] = 'default:stone_with_diamond'
|
ore_look[hash] = 'default:stone_with_diamond'
|
||||||
elseif sr <= 7 then
|
elseif sr <= 7 then
|
||||||
ore_look[hash] = 'default:stone_with_gold'
|
ore_look[hash] = 'default:stone_with_gold'
|
||||||
elseif sr <= 15 then
|
elseif sr <= 15 then
|
||||||
ore_look[hash] = 'default:stone_with_copper'
|
ore_look[hash] = 'default:stone_with_copper'
|
||||||
elseif sr <= 31 then
|
elseif sr <= 31 then
|
||||||
ore_look[hash] = 'default:stone_with_iron'
|
ore_look[hash] = 'default:stone_with_iron'
|
||||||
elseif sr <= 63 then
|
elseif sr <= 63 then
|
||||||
ore_look[hash] = 'default:stone_with_coal'
|
ore_look[hash] = 'default:stone_with_coal'
|
||||||
else
|
else
|
||||||
ore_look[hash] = 'default:stone'
|
ore_look[hash] = 'default:stone'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--return 'deciduous_forest', cave_look[hash], ore_look[hash]
|
--return 'deciduous_forest', cave_look[hash], ore_look[hash]
|
||||||
return biome_look[hash], cave_look[hash], ore_look[hash]
|
return biome_look[hash], cave_look[hash], ore_look[hash]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
loud_walking.get_biome = get_biome
|
loud_walking.get_biome = get_biome
|
||||||
|
|
||||||
|
@ -181,27 +181,27 @@ end
|
||||||
|
|
||||||
|
|
||||||
local function get_height(fdx, fdz, index, terrain_scale, ocean)
|
local function get_height(fdx, fdz, index, terrain_scale, ocean)
|
||||||
local terr = math_floor(terrain_map[index] * (terrain_scale or 1) + 0.5)
|
local terr = math_floor(terrain_map[index] * (terrain_scale or 1) + 0.5)
|
||||||
if ocean and terr > 0 then
|
if ocean and terr > 0 then
|
||||||
terr = math_floor(terr * (terrain_scale + 1.5) / 4 + 0.5)
|
terr = math_floor(terr * (terrain_scale + 1.5) / 4 + 0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
local d = - math_abs(math_abs(fdx - (half_pod.x - 0.5)) - math_abs(fdz - (half_pod.z - 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
|
if math_abs(fdx - half_pod.x) > math_abs(fdz - half_pod.z) then
|
||||||
d = d + half_pod.x - 2
|
d = d + half_pod.x - 2
|
||||||
else
|
else
|
||||||
d = d + half_pod.z - 2
|
d = d + half_pod.z - 2
|
||||||
end
|
end
|
||||||
|
|
||||||
if math_abs(terr) > d then
|
if math_abs(terr) > d then
|
||||||
if terr > 0 then
|
if terr > 0 then
|
||||||
terr = math_floor(d + 0.5)
|
terr = math_floor(d + 0.5)
|
||||||
elseif not ocean then
|
elseif not ocean then
|
||||||
terr = math_floor(0.5 - d)
|
terr = math_floor(0.5 - d)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return terr
|
return terr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,6 +210,12 @@ loud_walking.terrain = function(minp, maxp, data, p2data, area, baseline, height
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local extent_bottom = loud_walking.extent_bottom
|
||||||
|
local extent_top = loud_walking.extent_top
|
||||||
|
if maxp.y < baseline + extent_bottom or minp.y > baseline + extent_top then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if not loud_walking.csize then
|
if not loud_walking.csize then
|
||||||
loud_walking.csize = vector.add(vector.subtract(maxp, minp), 1)
|
loud_walking.csize = vector.add(vector.subtract(maxp, minp), 1)
|
||||||
|
|
||||||
|
@ -238,33 +244,33 @@ loud_walking.terrain = function(minp, maxp, data, p2data, area, baseline, height
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local ground = half_pod.y
|
local ground = half_pod.y
|
||||||
|
|
||||||
local t1 = os.clock()
|
local t1 = os.clock()
|
||||||
|
|
||||||
local index = 0
|
local index = 0
|
||||||
local index3d = 0
|
local index3d = 0
|
||||||
local last_biome, last_px, last_py, last_pz, node_top, node_filler, node_water_top, node_water, depth_top, depth_water_top, depth_filler, node_stone, ocean, swamp, beach, dunes, height
|
local last_biome, last_px, last_py, last_pz, node_top, node_filler, node_water_top, node_water, depth_top, depth_water_top, depth_filler, node_stone, ocean, swamp, beach, dunes, height
|
||||||
local biome_name, cave_lining, room_type, room_type_below, ore_type, land_biome
|
local biome_name, cave_lining, room_type, room_type_below, ore_type, land_biome
|
||||||
|
|
||||||
terrain_map = terrain_noise:get2dMap_flat({x=minp.x, y=minp.z}, terrain_map)
|
terrain_map = terrain_noise:get2dMap_flat({x=minp.x, y=minp.z}, terrain_map)
|
||||||
cave_map = cave_noise:get3dMap_flat(minp, cave_map)
|
cave_map = cave_noise:get3dMap_flat(minp, cave_map)
|
||||||
cloud_map = cloud_noise:get2dMap_flat({x=minp.x, y=minp.z}, cloud_map)
|
cloud_map = cloud_noise:get2dMap_flat({x=minp.x, y=minp.z}, cloud_map)
|
||||||
|
|
||||||
for z = minp.z, maxp.z do
|
for z = minp.z, maxp.z do
|
||||||
local dz = z - minp.z
|
local dz = z - minp.z
|
||||||
local fdz = z % fcsize.z
|
local fdz = z % fcsize.z
|
||||||
local pz = math_floor(z / fcsize.z)
|
local pz = math_floor(z / fcsize.z)
|
||||||
for x = minp.x, maxp.x do
|
for x = minp.x, maxp.x do
|
||||||
index = index + 1
|
index = index + 1
|
||||||
local dx = x - minp.x
|
local dx = x - minp.x
|
||||||
local fdx = x % fcsize.x
|
local fdx = x % fcsize.x
|
||||||
local px = math_floor(x / fcsize.x)
|
local px = math_floor(x / fcsize.x)
|
||||||
local in_cave = false
|
local in_cave = false
|
||||||
index3d = dz * csize.y * csize.x + dx + 1
|
index3d = dz * csize.y * csize.x + dx + 1
|
||||||
local ivm = area:index(x, minp.y, z)
|
local ivm = area:index(x, minp.y, z)
|
||||||
local cave_height = 0
|
local cave_height = 0
|
||||||
last_py = nil
|
last_py = nil
|
||||||
|
|
||||||
if px ~= last_px or pz ~= last_pz then
|
if px ~= last_px or pz ~= last_pz then
|
||||||
biome_name, cave_lining, ore_type = get_biome(x, 0, z)
|
biome_name, cave_lining, ore_type = get_biome(x, 0, z)
|
||||||
|
@ -302,9 +308,9 @@ loud_walking.terrain = function(minp, maxp, data, p2data, area, baseline, height
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for y = minp.y, maxp.y do
|
for y = minp.y, maxp.y do
|
||||||
local dy = y - minp.y
|
local dy = y - minp.y
|
||||||
local fdy = y - baseline + half_pod.y
|
local fdy = y - baseline + half_pod.y
|
||||||
local eff_biome = (y < half_pod.y) and biome_name or land_biome
|
local eff_biome = (y < half_pod.y) and biome_name or land_biome
|
||||||
|
|
||||||
if biome_name == 'control' then
|
if biome_name == 'control' then
|
||||||
|
@ -318,96 +324,96 @@ loud_walking.terrain = function(minp, maxp, data, p2data, area, baseline, height
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (data[ivm] == node['air'] or data[ivm] == node['ignore']) then
|
if not (data[ivm] == node['air'] or data[ivm] == node['ignore']) then
|
||||||
-- nop
|
-- nop
|
||||||
elseif biome_name == "control" and math_abs(fdx - half_pod.x) < 3 and math_abs(fdz - half_pod.z) < 3 then
|
elseif biome_name == "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"]
|
data[ivm] = node["loud_walking:air_ladder"]
|
||||||
elseif fdz >= pod_size.z or fdx >= pod_size.x or fdy >= pod_size.y 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
|
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']
|
data[ivm] = node['loud_walking:scrith']
|
||||||
else
|
else
|
||||||
--data[ivm] = node['loud_walking:vacuum']
|
|
||||||
end
|
|
||||||
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['loud_walking:vacuum']
|
|
||||||
in_cave = false
|
|
||||||
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['loud_walking:vacuum']
|
--data[ivm] = node['loud_walking:vacuum']
|
||||||
else
|
end
|
||||||
if biome_name == "control" 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[glass[3]]
|
--data[ivm] = node['loud_walking:vacuum']
|
||||||
elseif fdy < half_pod.y then
|
in_cave = false
|
||||||
data[ivm] = node["loud_walking:scrith"]
|
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
|
||||||
elseif biome_name == "underground" then
|
if math_abs(fdy - half_pod.y - 2) < 2 and (fdz == half_pod.z or fdx == half_pod.x) then
|
||||||
data[ivm] = node["loud_walking:scrith"]
|
--data[ivm] = node['loud_walking:vacuum']
|
||||||
elseif fdy == pod_size.y - 1 then
|
else
|
||||||
data[ivm] = node[glass[cloud_map[index] < cloud_i and 1 or 2]]
|
if biome_name == "control" then
|
||||||
else
|
data[ivm] = node[glass[3]]
|
||||||
data[ivm] = node[glass[1]]
|
elseif fdy < half_pod.y then
|
||||||
end
|
data[ivm] = node["loud_walking:scrith"]
|
||||||
end
|
elseif biome_name == "underground" 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"]
|
||||||
data[ivm] = node['loud_walking:scrith']
|
elseif fdy == pod_size.y - 1 then
|
||||||
elseif biome_name == "control" and fdy < pod_size.y then
|
data[ivm] = node[glass[cloud_map[index] < cloud_i and 1 or 2]]
|
||||||
if (math_abs(fdx - half_pod.x) < 3 or math_abs(fdz - half_pod.z) < 3) then
|
else
|
||||||
-- corridor
|
data[ivm] = node[glass[1]]
|
||||||
if fdy % 5 == 0 then
|
end
|
||||||
data[ivm] = node["loud_walking:control_floor"]
|
end
|
||||||
end
|
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
|
||||||
elseif ((math_abs(fdx - half_pod.x) % room_size == 3) or (math_abs(fdz - half_pod.z) % room_size == 3)) then
|
data[ivm] = node['loud_walking:scrith']
|
||||||
if fdy % 5 == 0 then
|
elseif biome_name == "control" and fdy < pod_size.y then
|
||||||
data[ivm] = node["loud_walking:control_floor"]
|
if (math_abs(fdx - half_pod.x) < 3 or math_abs(fdz - half_pod.z) < 3) then
|
||||||
elseif ((math_abs(fdx - half_pod.x) % room_size == 3 and (math_abs(fdz - half_pod.z) - (math_floor(room_size / 2) + 2)) % room_size > 3) or (math_abs(fdz - half_pod.z) % room_size == 3 and (math_abs(fdx - half_pod.x) - (math_floor(room_size / 2) + 2)) % room_size > 3)) then
|
-- corridor
|
||||||
data[ivm] = node["loud_walking:control_wall"]
|
if fdy % 5 == 0 then
|
||||||
end
|
data[ivm] = node["loud_walking:control_floor"]
|
||||||
elseif fdy % 5 == 0 then
|
end
|
||||||
if room_type == 1 then
|
elseif ((math_abs(fdx - half_pod.x) % room_size == 3) or (math_abs(fdz - half_pod.z) % room_size == 3)) then
|
||||||
if room_type_below == 1 then
|
if fdy % 5 == 0 then
|
||||||
data[ivm] = node["loud_walking:control_floor_alert_both"]
|
data[ivm] = node["loud_walking:control_floor"]
|
||||||
else
|
elseif ((math_abs(fdx - half_pod.x) % room_size == 3 and (math_abs(fdz - half_pod.z) - (math_floor(room_size / 2) + 2)) % room_size > 3) or (math_abs(fdz - half_pod.z) % room_size == 3 and (math_abs(fdx - half_pod.x) - (math_floor(room_size / 2) + 2)) % room_size > 3)) then
|
||||||
data[ivm] = node["loud_walking:control_floor_alert_up"]
|
data[ivm] = node["loud_walking:control_wall"]
|
||||||
end
|
end
|
||||||
elseif room_type_below == 1 then
|
elseif fdy % 5 == 0 then
|
||||||
data[ivm] = node["loud_walking:control_floor_alert_down"]
|
if room_type == 1 then
|
||||||
elseif room_type == 3 then
|
if room_type_below == 1 then
|
||||||
data[ivm] = node["loud_walking:control_floor_growth"]
|
data[ivm] = node["loud_walking:control_floor_alert_both"]
|
||||||
else
|
else
|
||||||
data[ivm] = node["loud_walking:control_floor"]
|
data[ivm] = node["loud_walking:control_floor_alert_up"]
|
||||||
end
|
end
|
||||||
elseif room_type == 2 and fdy < pod_size.y then
|
elseif room_type_below == 1 then
|
||||||
if math_abs(fdx - half_pod.x) % 4 < 3 and math_abs(fdz - half_pod.z) % 4 < 3 then
|
data[ivm] = node["loud_walking:control_floor_alert_down"]
|
||||||
data[ivm] = node["loud_walking:air_ladder"]
|
elseif room_type == 3 then
|
||||||
end
|
data[ivm] = node["loud_walking:control_floor_growth"]
|
||||||
elseif room_type == 3 then
|
else
|
||||||
if fdy % 5 == 1 then
|
data[ivm] = node["loud_walking:control_floor"]
|
||||||
local sr2 = math.random(20)
|
end
|
||||||
if sr2 == 1 then
|
elseif room_type == 2 and fdy < pod_size.y then
|
||||||
data[ivm] = node["loud_walking:control_plant_1"]
|
if math_abs(fdx - half_pod.x) % 4 < 3 and math_abs(fdz - half_pod.z) % 4 < 3 then
|
||||||
elseif sr2 == 2 then
|
data[ivm] = node["loud_walking:air_ladder"]
|
||||||
data[ivm] = node["loud_walking:control_plant_2"]
|
end
|
||||||
end
|
elseif room_type == 3 then
|
||||||
end
|
if fdy % 5 == 1 then
|
||||||
elseif room_type == 4 then
|
local sr2 = math.random(20)
|
||||||
if fdy % 5 == 4 and (((math_abs(fdx - half_pod.x) % room_size == 4 or math_abs(fdx - half_pod.x) % room_size == 2) and (math_abs(fdz - half_pod.z) - (math_floor(room_size / 2) + 2)) % room_size > 3) or ((math_abs(fdz - half_pod.z) % room_size == 4 or math_abs(fdz - half_pod.z) % room_size == 2) and (math_abs(fdx - half_pod.x) - (math_floor(room_size / 2) + 2)) % room_size > 3)) then
|
if sr2 == 1 then
|
||||||
data[ivm] = node["loud_walking:controls"]
|
data[ivm] = node["loud_walking:control_plant_1"]
|
||||||
end
|
elseif sr2 == 2 then
|
||||||
else
|
data[ivm] = node["loud_walking:control_plant_2"]
|
||||||
-- nop
|
end
|
||||||
end
|
end
|
||||||
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
|
elseif room_type == 4 then
|
||||||
data[ivm] = node["loud_walking:controls"]
|
if fdy % 5 == 4 and (((math_abs(fdx - half_pod.x) % room_size == 4 or math_abs(fdx - half_pod.x) % room_size == 2) and (math_abs(fdz - half_pod.z) - (math_floor(room_size / 2) + 2)) % room_size > 3) or ((math_abs(fdz - half_pod.z) % room_size == 4 or math_abs(fdz - half_pod.z) % room_size == 2) and (math_abs(fdx - half_pod.x) - (math_floor(room_size / 2) + 2)) % room_size > 3)) 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["loud_walking:controls"]
|
||||||
data[ivm] = node[glass[3]]
|
end
|
||||||
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
|
else
|
||||||
data[ivm] = node[glass[3]]
|
-- nop
|
||||||
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
|
end
|
||||||
-- ** water decorations **
|
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
|
||||||
--local deco = get_decoration(biome_name)
|
data[ivm] = node["loud_walking:controls"]
|
||||||
--if deco 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[deco]
|
data[ivm] = node[glass[3]]
|
||||||
--end
|
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
|
||||||
elseif not in_cave and fdy == height + ground + 1 then
|
data[ivm] = node[glass[3]]
|
||||||
|
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_name)
|
||||||
|
--if deco then
|
||||||
|
-- data[ivm] = node[deco]
|
||||||
|
--end
|
||||||
|
elseif not in_cave and fdy == height + ground + 1 then
|
||||||
if biomes[eff_biome].special_trees and loud_walking.tree_map[ x .. ',' .. z ] and (eff_biome ~= 'savanna' or math.random(20) == 1) then
|
if biomes[eff_biome].special_trees and loud_walking.tree_map[ x .. ',' .. z ] and (eff_biome ~= 'savanna' or math.random(20) == 1) then
|
||||||
local i = 1
|
local i = 1
|
||||||
for j = 1, 100 do
|
for j = 1, 100 do
|
||||||
|
@ -425,105 +431,105 @@ loud_walking.terrain = function(minp, maxp, data, p2data, area, baseline, height
|
||||||
data[ivm] = node[deco]
|
data[ivm] = node[deco]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod.y and fdy >= half_pod.y - (biomes[biome_name].depth_water_top or 1) then
|
elseif (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod.y and fdy >= half_pod.y - (biomes[biome_name].depth_water_top or 1) then
|
||||||
data[ivm] = node[biomes[biome_name].node_water_top or biomes[biome_name].node_water or "default:water_source"]
|
data[ivm] = node[biomes[biome_name].node_water_top or biomes[biome_name].node_water or "default:water_source"]
|
||||||
in_cave = false
|
in_cave = false
|
||||||
elseif (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod.y then
|
elseif (ocean or swamp or beach) and fdy > height + ground and fdy <= half_pod.y then
|
||||||
data[ivm] = node[biomes[biome_name].node_water or "default:water_source"]
|
data[ivm] = node[biomes[biome_name].node_water or "default:water_source"]
|
||||||
in_cave = false
|
in_cave = false
|
||||||
elseif fdy > height + ground then
|
elseif fdy > height + ground then
|
||||||
--data[ivm] = node["air"]
|
--data[ivm] = node["air"]
|
||||||
in_cave = false
|
in_cave = false
|
||||||
elseif cave_map[index3d] ^ 2 > (biome_name == "underground" and 0.5 or 1.3 - math.sin(fdy / (half_pod.y * 0.2))) then
|
elseif cave_map[index3d] ^ 2 > (biome_name == "underground" and 0.5 or 1.3 - math.sin(fdy / (half_pod.y * 0.2))) then
|
||||||
cave_height = cave_height + 1
|
cave_height = cave_height + 1
|
||||||
if height + ground >= fdy and not in_cave and fdy > height + ground - 10 then
|
if height + ground >= fdy and not in_cave and fdy > height + ground - 10 then
|
||||||
data[ivm] = node[biomes[eff_biome].node_top or "default:dirt_with_grass"]
|
data[ivm] = node[biomes[eff_biome].node_top or "default:dirt_with_grass"]
|
||||||
elseif fdy == 1 then
|
elseif fdy == 1 then
|
||||||
if not cave_lining and not ocean and not swamp and not beach and biome_name ~= "glacier" and math.random(6) == 1 then
|
if not cave_lining and not ocean and not swamp and not beach and biome_name ~= "glacier" and math.random(6) == 1 then
|
||||||
data[ivm] = node["default:lava_source"]
|
data[ivm] = node["default:lava_source"]
|
||||||
elseif ocean or swamp or beach then
|
elseif ocean or swamp or beach then
|
||||||
data[ivm] = node[biomes[eff_biome].node_filler or "default:dirt"]
|
data[ivm] = node[biomes[eff_biome].node_filler or "default:dirt"]
|
||||||
end
|
end
|
||||||
elseif (ocean or swamp or beach) and not in_cave and (biomes[eff_biome].node_stone or "default:stone") == "default:stone" and fdy < half_pod.y and math.random(20) == 1 then
|
elseif (ocean or swamp or beach) and not in_cave and (biomes[eff_biome].node_stone or "default:stone") == "default:stone" and fdy < half_pod.y and math.random(20) == 1 then
|
||||||
data[ivm] = node["loud_walking:glowing_fungal_stone"]
|
data[ivm] = node["loud_walking:glowing_fungal_stone"]
|
||||||
elseif (ocean or swamp or beach) and fdy < half_pod.y then
|
elseif (ocean or swamp or beach) and fdy < half_pod.y then
|
||||||
data[ivm] = node[biomes[biome_name].node_water or "default:water_source"]
|
data[ivm] = node[biomes[biome_name].node_water or "default:water_source"]
|
||||||
elseif cave_height == 3 and (biomes[eff_biome].node_filler or "default:dirt") == "default:dirt" and mushroom_stones[data[ivm - 3 * area.ystride]] and math.random(40) == 1 then
|
elseif cave_height == 3 and (biomes[eff_biome].node_filler or "default:dirt") == "default:dirt" and mushroom_stones[data[ivm - 3 * area.ystride]] and math.random(40) == 1 then
|
||||||
data[ivm] = node["loud_walking:giant_mushroom_cap"]
|
data[ivm] = node["loud_walking:giant_mushroom_cap"]
|
||||||
data[ivm - area.ystride] = node["loud_walking:giant_mushroom_stem"]
|
data[ivm - area.ystride] = node["loud_walking:giant_mushroom_stem"]
|
||||||
data[ivm - 2 * area.ystride] = node["loud_walking:giant_mushroom_stem"]
|
data[ivm - 2 * area.ystride] = node["loud_walking:giant_mushroom_stem"]
|
||||||
data[ivm - 3 * area.ystride] = node[biomes[eff_biome].node_filler or "default:dirt"]
|
data[ivm - 3 * area.ystride] = node[biomes[eff_biome].node_filler or "default:dirt"]
|
||||||
elseif cave_height == 2 and (biomes[eff_biome].node_filler or "default:dirt") == "default:dirt" and mushroom_stones[data[ivm - 2 * area.ystride]] and math.random(20) == 1 then
|
elseif cave_height == 2 and (biomes[eff_biome].node_filler or "default:dirt") == "default:dirt" and mushroom_stones[data[ivm - 2 * area.ystride]] and math.random(20) == 1 then
|
||||||
data[ivm] = node["loud_walking:huge_mushroom_cap"]
|
data[ivm] = node["loud_walking:huge_mushroom_cap"]
|
||||||
data[ivm - area.ystride] = node["loud_walking:giant_mushroom_stem"]
|
data[ivm - area.ystride] = node["loud_walking:giant_mushroom_stem"]
|
||||||
data[ivm - 2 * area.ystride] = node[biomes[eff_biome].node_filler or "default:dirt"]
|
data[ivm - 2 * area.ystride] = node[biomes[eff_biome].node_filler or "default:dirt"]
|
||||||
elseif not in_cave and (biomes[eff_biome].node_stone or "default:stone") == "default:stone" and not cave_lining and math.random(10) == 1 then
|
elseif not in_cave and (biomes[eff_biome].node_stone or "default:stone") == "default:stone" and not cave_lining and math.random(10) == 1 then
|
||||||
data[ivm] = node["loud_walking:stalagmite"]
|
data[ivm] = node["loud_walking:stalagmite"]
|
||||||
elseif not in_cave and (biomes[eff_biome].node_stone or "default:stone") == "default:ice" and math.random(10) == 1 then
|
elseif not in_cave and (biomes[eff_biome].node_stone or "default:stone") == "default:ice" and math.random(10) == 1 then
|
||||||
data[ivm] = node["loud_walking:icicle_up"]
|
data[ivm] = node["loud_walking:icicle_up"]
|
||||||
else
|
else
|
||||||
--data[ivm] = node["air"]
|
--data[ivm] = node["air"]
|
||||||
end
|
end
|
||||||
in_cave = true
|
in_cave = true
|
||||||
elseif cave_lining and cave_map[index3d] ^ 2 > (biome_name == "underground" and 0.4 or 1.2 - math.sin(fdy / (half_pod.y * 0.2))) then
|
elseif cave_lining and cave_map[index3d] ^ 2 > (biome_name == "underground" and 0.4 or 1.2 - math.sin(fdy / (half_pod.y * 0.2))) then
|
||||||
data[ivm] = node[cave_lining]
|
data[ivm] = node[cave_lining]
|
||||||
elseif fdy > height + ground - (biomes[eff_biome].depth_top or 1) then
|
elseif fdy > height + ground - (biomes[eff_biome].depth_top or 1) then
|
||||||
data[ivm] = node[biomes[eff_biome].node_top or "default:dirt_with_grass"]
|
data[ivm] = node[biomes[eff_biome].node_top or "default:dirt_with_grass"]
|
||||||
in_cave = false
|
in_cave = false
|
||||||
elseif fdy > height + ground - (biomes[eff_biome].depth_filler or 1) - (biomes[eff_biome].depth_top or 1) then
|
elseif fdy > height + ground - (biomes[eff_biome].depth_filler or 1) - (biomes[eff_biome].depth_top or 1) then
|
||||||
data[ivm] = node[biomes[eff_biome].node_filler or "default:dirt"]
|
data[ivm] = node[biomes[eff_biome].node_filler or "default:dirt"]
|
||||||
in_cave = false
|
in_cave = false
|
||||||
else
|
else
|
||||||
data[ivm] = node[biomes[eff_biome].node_stone or "default:stone"]
|
data[ivm] = node[biomes[eff_biome].node_stone or "default:stone"]
|
||||||
if math.random(100) == 1 then
|
if math.random(100) == 1 then
|
||||||
data[ivm] = node[ore_type]
|
data[ivm] = node[ore_type]
|
||||||
end
|
end
|
||||||
|
|
||||||
if in_cave and (biomes[eff_biome].node_stone or "default:stone") == "default:stone" and math.random(20) == 1 then
|
if in_cave and (biomes[eff_biome].node_stone or "default:stone") == "default:stone" and math.random(20) == 1 then
|
||||||
data[ivm] = node["loud_walking:glowing_fungal_stone"]
|
data[ivm] = node["loud_walking:glowing_fungal_stone"]
|
||||||
elseif in_cave and not (ocean or swamp or beach) and (biomes[eff_biome].node_stone or "default:stone") == "default:stone" and not cave_lining and math.random(10) == 1 then
|
elseif in_cave and not (ocean or swamp or beach) and (biomes[eff_biome].node_stone or "default:stone") == "default:stone" and not cave_lining and math.random(10) == 1 then
|
||||||
data[ivm - area.ystride] = node["loud_walking:stalactite"]
|
data[ivm - area.ystride] = node["loud_walking:stalactite"]
|
||||||
elseif in_cave and not (ocean or swamp or beach) and (biomes[eff_biome].node_stone or "default:stone") == "default:ice" and math.random(10) == 1 then
|
elseif in_cave and not (ocean or swamp or beach) and (biomes[eff_biome].node_stone or "default:stone") == "default:ice" and math.random(10) == 1 then
|
||||||
data[ivm - area.ystride] = node["loud_walking:icicle_down"]
|
data[ivm - area.ystride] = node["loud_walking:icicle_down"]
|
||||||
end
|
end
|
||||||
in_cave = false
|
in_cave = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if not in_cave then
|
if not in_cave then
|
||||||
cave_height = 0
|
cave_height = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
last_biome = biome_name
|
last_biome = biome_name
|
||||||
|
|
||||||
ivm = ivm + area.ystride
|
ivm = ivm + area.ystride
|
||||||
index3d = index3d + csize.x
|
index3d = index3d + csize.x
|
||||||
end
|
end
|
||||||
last_px = px
|
last_px = px
|
||||||
end
|
end
|
||||||
last_pz = pz
|
last_pz = pz
|
||||||
end
|
end
|
||||||
|
|
||||||
local t2 = os.clock()
|
local t2 = os.clock()
|
||||||
|
|
||||||
--last_px = nil
|
--last_px = nil
|
||||||
--last_pz = nil
|
--last_pz = nil
|
||||||
--for z = minp.z, maxp.z do
|
--for z = minp.z, maxp.z do
|
||||||
-- local fdz = z % fcsize.z
|
-- local fdz = z % fcsize.z
|
||||||
-- local pz = math_floor(z / fcsize.z)
|
-- local pz = math_floor(z / fcsize.z)
|
||||||
-- for x = minp.x, maxp.x do
|
-- for x = minp.x, maxp.x do
|
||||||
-- local fdx = x % fcsize.x
|
-- local fdx = x % fcsize.x
|
||||||
-- local px = math_floor(x / fcsize.x)
|
-- local px = math_floor(x / fcsize.x)
|
||||||
-- last_py = nil
|
-- last_py = nil
|
||||||
-- for y = minp.y, maxp.y do
|
-- for y = minp.y, maxp.y do
|
||||||
-- if fdz % tree_space == 0 and fdx % tree_space == 0 then
|
-- if fdz % tree_space == 0 and fdx % tree_space == 0 then
|
||||||
-- local fdy = y - baseline + half_pod.y
|
-- local fdy = y - baseline + half_pod.y
|
||||||
-- local pod = fdz < pod_size.z and fdx < pod_size.x and fdy > 0 and fdy < pod_size.y
|
-- local pod = fdz < pod_size.z and fdx < pod_size.x and fdy > 0 and fdy < pod_size.y
|
||||||
-- if px ~= last_px or pz ~= last_pz then
|
-- if px ~= last_px or pz ~= last_pz then
|
||||||
-- biome_name, cave_lining = get_biome(x, y, z)
|
-- biome_name, cave_lining = get_biome(x, y, z)
|
||||||
-- ocean = string.find(biome_name, "ocean") and true or false
|
-- ocean = string.find(biome_name, "ocean") and true or false
|
||||||
-- swamp = string.find(biome_name, "swamp") and true or false
|
-- swamp = string.find(biome_name, "swamp") and true or false
|
||||||
-- node_top = biomes[biome_name].node_top or "default:dirt_with_grass"
|
-- node_top = biomes[biome_name].node_top or "default:dirt_with_grass"
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
-- local rx = x + math.random(tree_space) - 1
|
-- local rx = x + math.random(tree_space) - 1
|
||||||
-- local rz = z + math.random(tree_space) - 1
|
-- local rz = z + math.random(tree_space) - 1
|
||||||
|
@ -545,9 +551,9 @@ loud_walking.terrain = function(minp, maxp, data, p2data, area, baseline, height
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
--end
|
--end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue