forked from MineClone5/MineClone5
Add noise/chunk border indicator switch into settingtypes
This commit is contained in:
parent
b518bfd5c2
commit
63193638ed
|
@ -1,5 +1,4 @@
|
||||||
local step = 1
|
local step = 1
|
||||||
local chunk_borders = false
|
|
||||||
|
|
||||||
local levels = {
|
local levels = {
|
||||||
[-9] = "black",
|
[-9] = "black",
|
||||||
|
@ -31,21 +30,24 @@ local mcl_structures_get_perlin_noise_level = mcl_structures.get_perlin_noise_le
|
||||||
local noise_offset_x_and_z = math_floor(mcl_mapgen.CS_NODES/2)
|
local noise_offset_x_and_z = math_floor(mcl_mapgen.CS_NODES/2)
|
||||||
|
|
||||||
mcl_mapgen.register_mapgen(function(minp, maxp, seed, vm_context)
|
mcl_mapgen.register_mapgen(function(minp, maxp, seed, vm_context)
|
||||||
local y0 = minp.y
|
if minetest.settings:get_bool("mcl_debug_struct_noise", false) then
|
||||||
for x0 = minp.x, maxp.x, step do
|
local y0 = minp.y
|
||||||
for z0 = minp.z, maxp.z, step do
|
for x0 = minp.x, maxp.x, step do
|
||||||
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})
|
for z0 = minp.z, maxp.z, step do
|
||||||
local amount
|
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})
|
||||||
if current_noise_level < 0 then
|
local amount
|
||||||
amount = math_max(math_ceil(current_noise_level * 9), -9)
|
if current_noise_level < 0 then
|
||||||
else
|
amount = math_max(math_ceil(current_noise_level * 9), -9)
|
||||||
amount = math_min(math_floor(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
|
||||||
local y0 = maxp.y - 9 + amount
|
|
||||||
minetest.set_node({x=x0, y=y0, z=z0}, {name = "mcl_core:glass_"..levels[amount]})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if chunk_borders then
|
|
||||||
|
if minetest.settings:get_bool("mcl_debug_chunk_borders", false) then
|
||||||
for x0 = minp.x, maxp.x, step do
|
for x0 = minp.x, maxp.x, step do
|
||||||
for y0 = minp.y, maxp.y, step do
|
for y0 = minp.y, maxp.y, step do
|
||||||
minetest.set_node({x=x0, y=y0, z=maxp.z}, {name = "mcl_core:glass"})
|
minetest.set_node({x=x0, y=y0, z=maxp.z}, {name = "mcl_core:glass"})
|
||||||
|
@ -56,5 +58,12 @@ mcl_mapgen.register_mapgen(function(minp, maxp, seed, vm_context)
|
||||||
minetest.set_node({x=maxp.x, y=y0, z=z0}, {name = "mcl_core:glass"})
|
minetest.set_node({x=maxp.x, y=y0, z=z0}, {name = "mcl_core:glass"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
for z0 = minp.z, maxp.z, step do
|
||||||
|
for x0 = minp.x, maxp.x, step do
|
||||||
|
minetest.set_node({x=x0, y=maxp.y, z=z0}, {name = "mcl_core:glass"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not minetest.settings:get_bool("mcl_debug_struct_noise", false) then
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end, -1)
|
end, 999999999999)
|
||||||
|
|
|
@ -11,7 +11,7 @@ if not mcl_mapgen.singlenode then
|
||||||
dofile(modpath .. "/ice_spike_large.lua")
|
dofile(modpath .. "/ice_spike_large.lua")
|
||||||
dofile(modpath .. "/jungle_temple.lua")
|
dofile(modpath .. "/jungle_temple.lua")
|
||||||
dofile(modpath .. "/nice_jungle_temple.lua")
|
dofile(modpath .. "/nice_jungle_temple.lua")
|
||||||
-- dofile(modpath .. "/noise_indicator.lua")
|
dofile(modpath .. "/noise_indicator.lua")
|
||||||
dofile(modpath .. "/stronghold.lua")
|
dofile(modpath .. "/stronghold.lua")
|
||||||
dofile(modpath .. "/witch_hut.lua")
|
dofile(modpath .. "/witch_hut.lua")
|
||||||
end
|
end
|
||||||
|
|
|
@ -167,4 +167,6 @@ kick_threshold (Cheat Kicking Threshold) int 10
|
||||||
|
|
||||||
[Debugging]
|
[Debugging]
|
||||||
# If enabled, this will show the itemstring of an item in the description.
|
# If enabled, this will show the itemstring of an item in the description.
|
||||||
mcl_item_id_debug (Item ID Debug) bool false
|
mcl_item_id_debug (Item ID Debug) bool false
|
||||||
|
mcl_debug_struct_noise (Show Structures Perlin Noise) bool false
|
||||||
|
mcl_debug_chunk_borders (Show Chunk Borders) bool false
|
||||||
|
|
Loading…
Reference in New Issue