diff --git a/init.lua b/init.lua index cd70333..eae6384 100644 --- a/init.lua +++ b/init.lua @@ -61,7 +61,7 @@ if not minetest.set_mapgen_setting then end 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) diff --git a/mapgen.lua b/mapgen.lua index e7a18ed..4161d2b 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -21,7 +21,6 @@ local glass = {"loud_walking:sky_scrith", "loud_walking:cloud_scrith", "loud_wal local data = {} local p2data = {} -- vm rotation data buffer -local lightmap = {} local vm, emin, emax, a, csize, heightmap, biomemap local div_sz_x, div_sz_z, minp, maxp, terrain, cave 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 if prob >= math.random(255) and schem.data[isch].name ~= "air" then data[ivm] = node[schem.data[isch].name] - lightmap[ivm] = 0 end local param2 = schem.data[isch].param2 or 0 p2data[ivm] = param2 @@ -283,8 +281,7 @@ local function generate(p_minp, p_maxp, seed) a = VoxelArea:new({MinEdge = emin, MaxEdge = emax}) csize = vector.add(vector.subtract(maxp, minp), 1) - --vm:set_lighting({day = 0, night = 0}, minp, maxp) - lightmap = vm:get_light_data() + vm:set_lighting({day = 0, night = 0}, minp, maxp) local ground = half_pod.y local heights = {} @@ -315,7 +312,6 @@ local function generate(p_minp, p_maxp, seed) local dy = y - minp.y local fdy = 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 biome, cave_lining = get_biome(x, y, z) end @@ -353,7 +349,6 @@ local function generate(p_minp, p_maxp, seed) 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['air'] - lightmap[ivm] = 0 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 @@ -363,10 +358,8 @@ local function generate(p_minp, p_maxp, seed) data[ivm] = node[glass[3]] 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.y - 1 then data[ivm] = node[glass[cloud[index] < cloud_i and 1 or 2]] else @@ -440,17 +433,13 @@ local function generate(p_minp, p_maxp, seed) --data[ivm] = node["air"] 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.y * 0.2))) then data[ivm] = node[cave_lining] - lightmap[ivm] = 0 elseif fdy > height + ground - depth_top then data[ivm] = node[node_top] - lightmap[ivm] = 0 in_cave = false elseif fdy > height + ground - depth_filler - depth_top then data[ivm] = node[node_filler] - lightmap[ivm] = 0 in_cave = false else 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 data[ivm - a.ystride] = node["loud_walking:icicle_down"] end - lightmap[ivm] = 0 in_cave = false end @@ -590,7 +578,7 @@ local function generate(p_minp, p_maxp, seed) vm:set_data(data) minetest.generate_ores(vm, minp, maxp) --vm:set_param2_data(p2data) - vm:set_light_data(lightmap) + vm:set_lighting({day = 0, night = 0}, minp, maxp) vm:update_liquids() vm:calc_lighting(minp, maxp, false) vm:write_to_map()