Write into log when starting/stopping to generate
This commit is contained in:
parent
7e23704bbe
commit
1af265c845
28
init.lua
28
init.lua
@ -1012,18 +1012,21 @@ minetest.register_globalstep(function(dtime)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
local build = function(pos, player_name)
|
||||
local build = function(pos, pos_hash, player_name)
|
||||
if not pos or not pos.x or not pos.y or not pos.z then
|
||||
minetest.log("error", "[perlin_explorer] build(): Invalid pos!")
|
||||
return
|
||||
end
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
if not loaded_areas[hash] then
|
||||
if not pos_hash then
|
||||
minetest.log("error", "[perlin_explorer] build(): Invalid pos_hash!")
|
||||
return
|
||||
end
|
||||
if not loaded_areas[pos_hash] then
|
||||
create_perlin(pos, {
|
||||
dimensions = current_perlin.dimensions,
|
||||
size = AUTOBUILD_SIZE,
|
||||
})
|
||||
loaded_areas[hash] = true
|
||||
loaded_areas[pos_hash] = true
|
||||
end
|
||||
end
|
||||
|
||||
@ -1042,10 +1045,25 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
end
|
||||
end
|
||||
local chunks = {}
|
||||
for n=1, #neighbors do
|
||||
local offset = vector.multiply(neighbors[n], AUTOBUILD_SIZE)
|
||||
local npos = vector.add(pos, offset)
|
||||
build(npos, player:get_player_name())
|
||||
local hash = minetest.hash_node_position(npos)
|
||||
if not loaded_areas[hash] then
|
||||
table.insert(chunks, {npos, hash})
|
||||
end
|
||||
end
|
||||
if #chunks > 0 then
|
||||
minetest.log("verbose", "[perlin_explorer] Started building "..#chunks.." chunk(s)")
|
||||
end
|
||||
for c=1, #chunks do
|
||||
local npos = chunks[c][1]
|
||||
local nhash = chunks[c][2]
|
||||
build(npos, nhash, player:get_player_name())
|
||||
end
|
||||
if #chunks > 0 then
|
||||
minetest.log("verbose", "[perlin_explorer] Done building "..#chunks.." chunk(s)")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
Loading…
x
Reference in New Issue
Block a user