Make parts of mapgen code more readable
This commit is contained in:
parent
172fbb6806
commit
7451d5b48f
@ -345,7 +345,12 @@ local generate_piece = function(minp, maxp, vm, prot_min, prot_max)
|
|||||||
local bheight = base_heightmap[z-minp.z+1][x-minp.x+1]
|
local bheight = base_heightmap[z-minp.z+1][x-minp.x+1]
|
||||||
local theight = result_heightmap[z-minp.z+1][x-minp.x+1]
|
local theight = result_heightmap[z-minp.z+1][x-minp.x+1]
|
||||||
|
|
||||||
local dirt = (theight > 2 and theight < hills_thresh and isln_trees[z-minp.z+1][x-minp.x+1] > 0) and c_dirt_l or c_dirt_g
|
local dirt
|
||||||
|
if (theight > 2 and theight < hills_thresh and isln_trees[z-minp.z+1][x-minp.x+1] > 0) then
|
||||||
|
dirt = c_dirt_l
|
||||||
|
else
|
||||||
|
dirt = c_dirt_g
|
||||||
|
end
|
||||||
|
|
||||||
if y < theight then
|
if y < theight then
|
||||||
if y <= CAVESTONE_LEVEL then
|
if y <= CAVESTONE_LEVEL then
|
||||||
@ -354,7 +359,15 @@ local generate_piece = function(minp, maxp, vm, prot_min, prot_max)
|
|||||||
vm_data[vi] = c_stone
|
vm_data[vi] = c_stone
|
||||||
end
|
end
|
||||||
elseif y==ceil(theight) then
|
elseif y==ceil(theight) then
|
||||||
vm_data[vi]= y < -3 and c_sand_dark or y<4 and c_sand or (y<60-random(3) and dirt or c_snow)
|
if y < -3 then
|
||||||
|
vm_data[vi] = c_sand_dark
|
||||||
|
elseif y < 4 then
|
||||||
|
vm_data[vi] = c_sand
|
||||||
|
elseif y < 60 - random(3) then
|
||||||
|
vm_data[vi] = dirt
|
||||||
|
else
|
||||||
|
vm_data[vi] = c_snow
|
||||||
|
end
|
||||||
elseif y <= WATER_LEVEL then
|
elseif y <= WATER_LEVEL then
|
||||||
vm_data[vi] = c_water
|
vm_data[vi] = c_water
|
||||||
-- Calculate lighting manually (see above)
|
-- Calculate lighting manually (see above)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user