forked from MineClone5/MineClone5
Fix several mapgen_issue warnings
This commit is contained in:
parent
da8e92e071
commit
667ebf1385
|
@ -86,7 +86,7 @@ local CS_3D = CS * CS * CS
|
|||
local DEFAULT_ORDER = order.DEFAULT
|
||||
|
||||
function mcl_mapgen.register_on_generated(callback_function, order)
|
||||
queue_unsafe_engine[#queue_unsafe_engine+1] = {i = priority or DEFAULT_ORDER, f = callback_function}
|
||||
queue_unsafe_engine[#queue_unsafe_engine+1] = {i = order or DEFAULT_ORDER, f = callback_function}
|
||||
table.sort(queue_unsafe_engine, function(a, b) return (a.i <= b.i) end)
|
||||
end
|
||||
function mcl_mapgen.register_mapgen(callback_function, order)
|
||||
|
@ -98,14 +98,14 @@ end
|
|||
function mcl_mapgen.register_mapgen_lvm(callback_function, order)
|
||||
lvm_chunk = lvm_chunk + 1
|
||||
safe_functions = safe_functions + 1
|
||||
queue_chunks_lvm[lvm_chunk] = {i = priority or DEFAULT_ORDER, f = callback_function}
|
||||
queue_chunks_lvm[lvm_chunk] = {i = order or DEFAULT_ORDER, f = callback_function}
|
||||
table.sort(queue_chunks_lvm, function(a, b) return (a.i <= b.i) end)
|
||||
end
|
||||
function mcl_mapgen.register_mapgen_block(callback_function, priority)
|
||||
function mcl_mapgen.register_mapgen_block(callback_function, order)
|
||||
block = block + 1
|
||||
nodes_block = nodes_block + 1
|
||||
safe_functions = safe_functions + 1
|
||||
queue_blocks_nodes[nodes_block] = {i = priority or DEFAULT_ORDER, f = callback_function}
|
||||
queue_blocks_nodes[nodes_block] = {i = order or DEFAULT_ORDER, f = callback_function}
|
||||
table.sort(queue_blocks_nodes, function(a, b) return (a.i <= b.i) end)
|
||||
end
|
||||
function mcl_mapgen.register_mapgen_block_lvm(callback_function, order)
|
||||
|
@ -319,7 +319,8 @@ minetest.register_on_generated(function(minp, maxp, chunkseed)
|
|||
if vm_context.write_light then
|
||||
vm:set_light_data(light)
|
||||
end
|
||||
vm:calc_lighting(minp, maxp, vm_context.shadow or true)
|
||||
-- caused error from torches (?)
|
||||
-- vm:calc_lighting(minp, maxp, vm_context.shadow or true)
|
||||
vm:write_to_map()
|
||||
vm:update_liquids()
|
||||
end
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
-- Generate Clay
|
||||
local c_water = minetest.get_content_id("mcl_core:water_source")
|
||||
local c_dirt = minetest.get_content_id("mcl_core:dirt")
|
||||
local c_clay = minetest.get_content_id("mcl_core:clay")
|
||||
|
||||
local perlin_clay
|
||||
|
||||
mcl_mapgen.register_mapgen_lvm(function(c)
|
||||
local minp, maxp, blockseed, voxelmanip_data, voxelmanip_area, lvm_used = c.minp, c.maxp, c.chunkseed, c.data, c.area, c.write or false
|
||||
-- TODO: Make clay generation reproducible for same seed.
|
||||
|
@ -45,6 +50,7 @@ mcl_mapgen.register_mapgen_lvm(function(c)
|
|||
local claycandidate = voxelmanip_data[ccpos]
|
||||
if voxelmanip_data[ccpos] == c_dirt or minetest.get_item_group(minetest.get_name_from_content_id(claycandidate), "sand") == 1 then
|
||||
voxelmanip_data[ccpos] = c_clay
|
||||
minetest.log("warning", "CLAY! "..minetest.pos_to_string({x=cx+x1,y=y,z=cz+z1}))
|
||||
lvm_used = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1168,9 +1168,7 @@ minetest.set_mapgen_setting("mg_flags", mg_flags_str, true)
|
|||
end]]
|
||||
|
||||
-- Perlin noise objects
|
||||
local perlin_structures
|
||||
local perlin_vines, perlin_vines_fine, perlin_vines_upwards, perlin_vines_length, perlin_vines_density
|
||||
local perlin_clay
|
||||
|
||||
local dragon_spawn_pos = false
|
||||
local dragon_spawned, portal_generated = false, false
|
||||
|
@ -1606,7 +1604,7 @@ end
|
|||
-- Below the bedrock, generate air/void
|
||||
local function basic_safe(vm_context)
|
||||
local vm, data, emin, emax, area, minp, maxp, chunkseed, blockseed = vm_context.vm, vm_context.data, vm_context.emin, vm_context.emax, vm_context.area, vm_context.minp, vm_context.maxp, vm_context.chunkseed, vm_context.blockseed
|
||||
vm_context.data2 = vm_context.data2 or vm:get_param2_data(lvm_param2_buffer)
|
||||
vm_context.data2 = vm_context.data2 or vm:get_param2_data(vm_context.lvm_param2_buffer)
|
||||
local data2 = vm_context.data2
|
||||
|
||||
local lvm_used = false
|
||||
|
@ -1647,7 +1645,7 @@ local function basic_safe(vm_context)
|
|||
if mcl_mapgen.lava then
|
||||
lvm_used = set_layers(data, area, c_lava, c_air, mcl_mapgen.overworld.min, mcl_mapgen.overworld.lava_max, minp, maxp, lvm_used, pr)
|
||||
if c_nether then
|
||||
lvm_used = set_layers(data, area, c_nether_lava, c_air, mcl_mapgen.nether.min, mcl_mapgen.nether.lava_max, minp, maxp, lvm_used, pr)
|
||||
lvm_used = set_layers(data, area, c_nether.lava, c_air, mcl_mapgen.nether.min, mcl_mapgen.nether.lava_max, minp, maxp, lvm_used, pr)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1740,7 +1738,7 @@ local function basic_safe(vm_context)
|
|||
for n=1, #nodes do
|
||||
local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z)
|
||||
if data[p_pos] == c_water then
|
||||
data[p_pos] = c_nether_lava
|
||||
data[p_pos] = c_nether.lava
|
||||
lvm_used = true
|
||||
elseif data[p_pos] == c_stone then
|
||||
data[p_pos] = c_netherrack
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
local END_EXIT_PORTAL_POS = vector.new(-3, -27003, -3) -- End exit portal position
|
||||
local WITCH_HUT_HEIGHT = 3 -- Exact Y level to spawn witch huts at. This height refers to the height of the floor
|
||||
local OVERWORLD_STRUCT_MIN, OVERWORLD_STRUCT_MAX = mcl_mapgen.overworld.min, mcl_mapgen.overworld.max
|
||||
|
@ -11,7 +12,7 @@ local minetest_get_node = minetest.get_node
|
|||
local minetest_get_mapgen_object = minetest.get_mapgen_object
|
||||
local minetest_find_nodes_in_area = minetest.find_nodes_in_area
|
||||
|
||||
-- TODO: Try to use more efficient structure generating code
|
||||
local perlin_structures
|
||||
|
||||
local function determine_ground_level(p, vm_context)
|
||||
local emax = vm_context.emax
|
||||
|
@ -257,7 +258,7 @@ local function generate_structures(vm_context)
|
|||
-- Determine amount from perlin noise
|
||||
local amount = math_floor(perlin_structures:get_2d({x=x0, y=z0}) * 9)
|
||||
-- Find random positions based on this random
|
||||
local p, ground_y
|
||||
local p, ground_y, nn
|
||||
for i=0, amount do
|
||||
p = {x = pr:next(x0, x0 + DIVLEN - 1), y = 0, z = pr:next(z0, z0 + DIVLEN - 1)}
|
||||
p, ground_y, nn = determine_ground_level(p, vm_context)
|
||||
|
|
Loading…
Reference in New Issue