How is the event on_chunk_generated called?
I expected it to be called once a chunk is generated for the first time. Not, if a chunk is updated.
I wrote the following code:
Code: Select all
script.on_event(defines.events.on_chunk_generated, function(event)
local entities = game.surfaces[1].find_entities_filtered{area = event.area, name = global.Ore}
for i=1,#entities,1 do
table.insert(global.oreList, entities[i])
end
global.numChunks = global.numChunks + 1
-- DebugInfo
if global.TDebug == true then
game.print("Number of Chunks: "..tostring(global.numChunks))
end
end) -- .on_chunk_generated
I expected it to stop somewhere. Because no more chunks should be generated without any movement of the player to the fog of war?
Actually, it seems that the counter raised every second.
I am aming for a chunkiteration, while my calculations are restricted to work in one chunk at a time only.