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) return math.abs(y) - math.abs(center_point)
elseif center_point < 0 and y < 0 then elseif center_point < 0 and y < 0 then
return math.abs(center_point) - math.abs(y) 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 else
return center_point - y return center_point - y
end 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 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!") minetest.log("error", "Number of layers for the given layer height exceeds map height!")
end end
minetest.set_mapgen_params({mgname="singlenode", flags="nolight"}) minetest.set_mapgen_params({mgname="singlenode"})
end) end)
minetest.register_on_generated(function(minp, maxp) minetest.register_on_generated(function(minp, maxp)

View File

@ -99,7 +99,7 @@ local perlin_worm_start_params = {
persist = 0.7 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 sidelen = maxp.x - minp.x + 1
local blocklen = sidelen / 5 local blocklen = sidelen / 5
--3d --3d
@ -114,10 +114,6 @@ function mmgen_testauri.generate(current_layer, minp, maxp, offset_minp, offset_
local ystridevm = sidelen + 32 local ystridevm = sidelen + 32
local zstridevm = ystridevm ^ 2 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 if last_layer ~= current_layer then
height_map = minetest.get_perlin_map(layers[current_layer].height_map_params, chulenxz) 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) 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 nixz = nixz + sidelen
end end
vm:set_data(vm_data)
vm:update_liquids()
vm:calc_lighting()
vm:write_to_map()
end end