Fixed offset y for the case where the center point is above 0 but

the y is below
This commit is contained in:
evrooije 2018-07-22 17:03:13 +02:00
parent b0093461a5
commit ce83c0ae17
2 changed files with 4 additions and 10 deletions

View File

@ -54,6 +54,8 @@ function multi_map.get_offset_y(y)
return math.abs(y) - math.abs(center_point)
elseif center_point < 0 and y < 0 then
return math.abs(center_point) - math.abs(y)
elseif center_point > 0 and y < 0 then
return math.abs(y) - math.abs(center_point)
else
return center_point - y
end
@ -170,7 +172,7 @@ minetest.register_on_mapgen_init(function(mapgen_params)
if multi_map.number_of_layers * multi_map.layer_height > multi_map.map_height then
minetest.log("error", "Number of layers for the given layer height exceeds map height!")
end
minetest.set_mapgen_params({mgname="singlenode", flags="nolight"})
minetest.set_mapgen_params({mgname="singlenode"})
end)
minetest.register_on_generated(function(minp, maxp)

View File

@ -99,7 +99,7 @@ local perlin_worm_start_params = {
persist = 0.7
}
function mmgen_testauri.generate(current_layer, minp, maxp, offset_minp, offset_maxp)
function mmgen_testauri.generate(current_layer, vm, area, vm_data, minp, maxp, offset_minp, offset_maxp)
local sidelen = maxp.x - minp.x + 1
local blocklen = sidelen / 5
--3d
@ -114,10 +114,6 @@ function mmgen_testauri.generate(current_layer, minp, maxp, offset_minp, offset_
local ystridevm = sidelen + 32
local zstridevm = ystridevm ^ 2
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local vm_data = vm:get_data()
if last_layer ~= current_layer then
height_map = minetest.get_perlin_map(layers[current_layer].height_map_params, chulenxz)
terrain_type_map = minetest.get_perlin_map(layers[current_layer].terrain_type_params, chulenxz)
@ -176,8 +172,4 @@ function mmgen_testauri.generate(current_layer, minp, maxp, offset_minp, offset_
nixz = nixz + sidelen
end
vm:set_data(vm_data)
vm:update_liquids()
vm:calc_lighting()
vm:write_to_map()
end