Change water level.
parent
c437d102ea
commit
8a7c9d5832
2
init.lua
2
init.lua
|
@ -61,7 +61,7 @@ if not minetest.set_mapgen_setting then
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_mapgen_init(function(mgparams)
|
minetest.register_on_mapgen_init(function(mgparams)
|
||||||
minetest.set_mapgen_params({mgname="singlenode", flags="nolight"})
|
minetest.set_mapgen_params({mgname="singlenode", water_level=-31000, flags="nolight"})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
16
mapgen.lua
16
mapgen.lua
|
@ -21,7 +21,6 @@ local glass = {"loud_walking:sky_scrith", "loud_walking:cloud_scrith", "loud_wal
|
||||||
|
|
||||||
local data = {}
|
local data = {}
|
||||||
local p2data = {} -- vm rotation data buffer
|
local p2data = {} -- vm rotation data buffer
|
||||||
local lightmap = {}
|
|
||||||
local vm, emin, emax, a, csize, heightmap, biomemap
|
local vm, emin, emax, a, csize, heightmap, biomemap
|
||||||
local div_sz_x, div_sz_z, minp, maxp, terrain, cave
|
local div_sz_x, div_sz_z, minp, maxp, terrain, cave
|
||||||
local cloud
|
local cloud
|
||||||
|
@ -190,7 +189,6 @@ local function place_schematic(pos, schem, center)
|
||||||
local prob = schem.data[isch].prob or schem.data[isch].param1 or 255
|
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
|
if prob >= math.random(255) and schem.data[isch].name ~= "air" then
|
||||||
data[ivm] = node[schem.data[isch].name]
|
data[ivm] = node[schem.data[isch].name]
|
||||||
lightmap[ivm] = 0
|
|
||||||
end
|
end
|
||||||
local param2 = schem.data[isch].param2 or 0
|
local param2 = schem.data[isch].param2 or 0
|
||||||
p2data[ivm] = param2
|
p2data[ivm] = param2
|
||||||
|
@ -283,8 +281,7 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||||
csize = vector.add(vector.subtract(maxp, minp), 1)
|
csize = vector.add(vector.subtract(maxp, minp), 1)
|
||||||
|
|
||||||
--vm:set_lighting({day = 0, night = 0}, minp, maxp)
|
vm:set_lighting({day = 0, night = 0}, minp, maxp)
|
||||||
lightmap = vm:get_light_data()
|
|
||||||
|
|
||||||
local ground = half_pod.y
|
local ground = half_pod.y
|
||||||
local heights = {}
|
local heights = {}
|
||||||
|
@ -315,7 +312,6 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
local dy = y - minp.y
|
local dy = y - minp.y
|
||||||
local fdy = y % fcsize.y
|
local fdy = y % fcsize.y
|
||||||
local py = math_floor(y / fcsize.y)
|
local py = math_floor(y / fcsize.y)
|
||||||
lightmap[ivm] = 0
|
|
||||||
if py ~= last_py or px ~= last_px or pz ~= last_pz then
|
if py ~= last_py or px ~= last_px or pz ~= last_pz then
|
||||||
biome, cave_lining = get_biome(x, y, z)
|
biome, cave_lining = get_biome(x, y, z)
|
||||||
end
|
end
|
||||||
|
@ -353,7 +349,6 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
end
|
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
|
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']
|
--data[ivm] = node['air']
|
||||||
lightmap[ivm] = 0
|
|
||||||
in_cave = false
|
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
|
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
|
if math_abs(fdy - half_pod.y - 2) < 2 and (fdz == half_pod.z or fdx == half_pod.x) then
|
||||||
|
@ -363,10 +358,8 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
data[ivm] = node[glass[3]]
|
data[ivm] = node[glass[3]]
|
||||||
elseif fdy < half_pod.y then
|
elseif fdy < half_pod.y then
|
||||||
data[ivm] = node["loud_walking:scrith"]
|
data[ivm] = node["loud_walking:scrith"]
|
||||||
lightmap[ivm] = 0
|
|
||||||
elseif biome == "underground" then
|
elseif biome == "underground" then
|
||||||
data[ivm] = node["loud_walking:scrith"]
|
data[ivm] = node["loud_walking:scrith"]
|
||||||
lightmap[ivm] = 0
|
|
||||||
elseif fdy == pod_size.y - 1 then
|
elseif fdy == pod_size.y - 1 then
|
||||||
data[ivm] = node[glass[cloud[index] < cloud_i and 1 or 2]]
|
data[ivm] = node[glass[cloud[index] < cloud_i and 1 or 2]]
|
||||||
else
|
else
|
||||||
|
@ -440,17 +433,13 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
--data[ivm] = node["air"]
|
--data[ivm] = node["air"]
|
||||||
end
|
end
|
||||||
in_cave = true
|
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.y * 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]
|
data[ivm] = node[cave_lining]
|
||||||
lightmap[ivm] = 0
|
|
||||||
elseif fdy > height + ground - depth_top then
|
elseif fdy > height + ground - depth_top then
|
||||||
data[ivm] = node[node_top]
|
data[ivm] = node[node_top]
|
||||||
lightmap[ivm] = 0
|
|
||||||
in_cave = false
|
in_cave = false
|
||||||
elseif fdy > height + ground - depth_filler - depth_top then
|
elseif fdy > height + ground - depth_filler - depth_top then
|
||||||
data[ivm] = node[node_filler]
|
data[ivm] = node[node_filler]
|
||||||
lightmap[ivm] = 0
|
|
||||||
in_cave = false
|
in_cave = false
|
||||||
else
|
else
|
||||||
data[ivm] = node[node_stone]
|
data[ivm] = node[node_stone]
|
||||||
|
@ -461,7 +450,6 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
elseif in_cave and not (ocean or swamp or beach) and node_stone == "default:ice" and math.random(10) == 1 then
|
elseif in_cave and not (ocean or swamp or beach) and node_stone == "default:ice" and math.random(10) == 1 then
|
||||||
data[ivm - a.ystride] = node["loud_walking:icicle_down"]
|
data[ivm - a.ystride] = node["loud_walking:icicle_down"]
|
||||||
end
|
end
|
||||||
lightmap[ivm] = 0
|
|
||||||
in_cave = false
|
in_cave = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -590,7 +578,7 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
minetest.generate_ores(vm, minp, maxp)
|
minetest.generate_ores(vm, minp, maxp)
|
||||||
--vm:set_param2_data(p2data)
|
--vm:set_param2_data(p2data)
|
||||||
vm:set_light_data(lightmap)
|
vm:set_lighting({day = 0, night = 0}, minp, maxp)
|
||||||
vm:update_liquids()
|
vm:update_liquids()
|
||||||
vm:calc_lighting(minp, maxp, false)
|
vm:calc_lighting(minp, maxp, false)
|
||||||
vm:write_to_map()
|
vm:write_to_map()
|
||||||
|
|
Loading…
Reference in New Issue