1
0
Fork 0

optimize bedrock/void replacement

This commit is contained in:
cora 2022-10-06 16:56:21 +02:00
parent 633d7a2fe1
commit 9aef6b8ee3
1 changed files with 26 additions and 8 deletions

View File

@ -269,21 +269,37 @@ function mcl_vars.get_node(p, force, us_timeout)
-- it still can return "ignore", LOL, even if force = true, but only after time out -- it still can return "ignore", LOL, even if force = true, but only after time out
end end
-- lbm to update from old mapgen depth to new. potentially affects a lot of nodes inducing lag. -- Abm to update from old mapgen depth to new. potentially affects a lot of nodes inducing lag.
-- Also it will not generate ores or bedrock pattern. -- Also it will not generate ores or bedrock pattern.
local adjacents = {
vector.new(1,0,0),
vector.new(0,1,0),
vector.new(0,0,1),
vector.new(-1,0,0),
vector.new(0,-1,0),
vector.new(0,0,-1),
}
local function register_abms() local function register_abms()
minetest.register_abm({ minetest.register_abm({
label = "Replace bedrock from old bedrock layer and air/void below to deepslate", label = "Replace bedrock from old bedrock layer and air/void below to deepslate",
name = ":mcl_mapgen_core:replace_old_void", name = ":mcl_mapgen_core:replace_old_void",
nodenames = { "mcl_core:void" }, nodenames = { "mcl_core:void" },
chance = 30, chance = 1,
interval = 25, interval = 5,
min_y = mcl_vars.mg_bedrock_overworld_max, min_y = mcl_vars.mg_bedrock_overworld_max,
max_y = mcl_vars.mg_overworld_min_old, max_y = mcl_vars.mg_overworld_min_old,
action = function(p) action = function(p)
minetest.after(0,function(p) minetest.log("void")
minetest.delete_area(p,p) if p.y > mcl_vars.mg_overworld_min_old - 5 then
end,p) minetest.bulk_set_node(minetest.find_nodes_in_area(vector.new(p.x-5,mcl_vars.mg_overworld_min_old-5,p.z-5),vector.new(p.x+5,mcl_vars.mg_overworld_min_old,p.z+5),{"mcl_core:void"}),{name="mcl_deepslate:deepslate"})
else
minetest.after(0,function(p)
if minetest.get_node(p).name == "mcl_core:void" then
minetest.delete_area(p,p)
end
end,p)
end
end end
}) })
minetest.register_abm({ minetest.register_abm({
@ -295,9 +311,11 @@ local function register_abms()
min_y = mcl_vars.mg_overworld_min_old, min_y = mcl_vars.mg_overworld_min_old,
max_y = mcl_vars.mg_overworld_min_old + 4, max_y = mcl_vars.mg_overworld_min_old + 4,
action = function(p) action = function(p)
if minetest.get_node(vector.offset(p,0,-1,0)).name ~= "mcl_core:void" then minetest.log("bedr")
minetest.set_node(p,{name="mcl_core:stone"}) if minetest.find_node_near(p,24,{"mcl_core:void"}) then
return
end end
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.new(p.x-5,mcl_vars.mg_overworld_min_old-1,p.z-5),vector.new(p.x+5,mcl_vars.mg_overworld_min_old+5,p.z+5),{"mcl_core:bedrock",}),{name="mcl_deepslate:deepslate"})
end end
}) })
end end