make sure a listed block is indeed loaded before writing to it

(in case the mapgen takes long enough on a server that players
have wandered off and the server has unloaded blocks)
This commit is contained in:
Vanessa Dannenberg 2021-04-01 09:27:00 -04:00
parent 9ed4858518
commit 43b2c6db42
1 changed files with 4 additions and 2 deletions

View File

@ -450,7 +450,8 @@ function biome_lib:generate_block_with_air_checking()
if #biome_lib.surface_nodes_aircheck.blockhash > 0 then
biome_lib:dbg("Mapblock at "..minetest.pos_to_string(minp).." added, with "..#biome_lib.surface_nodes_aircheck.blockhash.." surface nodes detected.")
end
elseif not minetest.get_node_or_nil(minp) then
minetest.load_area(minp)
else
if biome_lib.actionslist_aircheck[biome_lib.actioncount_aircheck.blockhash] then
-- [1] is biome, [2] is node/function/model
@ -488,7 +489,8 @@ function biome_lib:generate_block_no_aircheck()
biome_lib.surface_nodes_no_aircheck.blockhash =
minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_no_aircheck)
biome_lib.actioncount_no_aircheck.blockhash = 1
elseif not minetest.get_node_or_nil(minp) then
minetest.load_area(minp)
else
if biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash] then
biome_lib:populate_surfaces(