2022-01-17 03:48:59 +01:00
|
|
|
local step = 1
|
2022-01-17 17:43:30 +01:00
|
|
|
local chunk_borders = false
|
2022-01-17 03:48:59 +01:00
|
|
|
|
2022-01-16 16:20:42 +01:00
|
|
|
local levels = {
|
|
|
|
[-9] = "black",
|
|
|
|
[-8] = "brown",
|
|
|
|
[-7] = "brown",
|
|
|
|
[-6] = "gray",
|
|
|
|
[-5] = "gray",
|
|
|
|
[-4] = "red",
|
|
|
|
[-3] = "orange",
|
|
|
|
[-2] = "purple",
|
|
|
|
[-1] = "magenta",
|
|
|
|
[0] = "pink",
|
|
|
|
[1] = "yellow",
|
|
|
|
[2] = "green",
|
|
|
|
[3] = "lime",
|
|
|
|
[4] = "blue",
|
|
|
|
[5] = "cyan",
|
|
|
|
[6] = "light_blue",
|
|
|
|
[7] = "silver",
|
|
|
|
[8] = "silver",
|
|
|
|
[9] = "white",
|
|
|
|
}
|
|
|
|
|
|
|
|
local math_min, math_max = math.min, math.max
|
|
|
|
local math_floor, math_ceil = math.floor, math.ceil
|
|
|
|
|
2022-01-17 17:43:30 +01:00
|
|
|
local mcl_structures_get_perlin_noise_level = mcl_structures.get_perlin_noise_level
|
|
|
|
|
|
|
|
local noise_offset_x_and_z = math_floor(mcl_mapgen.CS_NODES/2)
|
|
|
|
|
2022-01-16 16:20:42 +01:00
|
|
|
mcl_mapgen.register_mapgen(function(minp, maxp, seed, vm_context)
|
2022-01-17 03:17:52 +01:00
|
|
|
local y0 = minp.y
|
2022-01-17 03:48:59 +01:00
|
|
|
for x0 = minp.x, maxp.x, step do
|
|
|
|
for z0 = minp.z, maxp.z, step do
|
2022-01-17 17:43:30 +01:00
|
|
|
local current_noise_level = mcl_structures_get_perlin_noise_level({x = x0 - noise_offset_x_and_z, y = y0, z = z0 - noise_offset_x_and_z})
|
2022-01-16 16:20:42 +01:00
|
|
|
local amount
|
|
|
|
if current_noise_level < 0 then
|
|
|
|
amount = math_max(math_ceil(current_noise_level * 9), -9)
|
|
|
|
else
|
|
|
|
amount = math_min(math_floor(current_noise_level * 9), 9)
|
|
|
|
end
|
|
|
|
local y0 = maxp.y - 9 + amount
|
|
|
|
minetest.set_node({x=x0, y=y0, z=z0}, {name = "mcl_core:glass_"..levels[amount]})
|
|
|
|
end
|
|
|
|
end
|
2022-01-17 03:48:59 +01:00
|
|
|
if chunk_borders then
|
|
|
|
for x0 = minp.x, maxp.x, step do
|
|
|
|
for y0 = minp.y, maxp.y, step do
|
|
|
|
minetest.set_node({x=x0, y=y0, z=maxp.z}, {name = "mcl_core:glass"})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for z0 = minp.z, maxp.z, step do
|
|
|
|
for y0 = minp.y, maxp.y, step do
|
|
|
|
minetest.set_node({x=maxp.x, y=y0, z=z0}, {name = "mcl_core:glass"})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-01-16 16:20:42 +01:00
|
|
|
end, -1)
|