[togos][0.16.16] Regenerate oil wells changes their position
Posted: Sun Jan 21, 2018 9:13 pm
I'm regenerating resources on my map, using the following command:
Ores appear at the same position after regenerating, but the oil wells spawn at different positions when I execute the command once. The location and size of the clusters is the same, but within the clusters they are spawned differently. The position only changes the first time I run this. This seems to happen outside the starting area too.
Code: Select all
/c
local r = 20
local surface = game.player.surface
local entities = {"uranium-ore", "crude-oil", "iron-ore", "copper-ore", "coal", "stone", }
for _, ent in pairs(surface.find_entities_filtered{area={{-r*32, -r*32}, {r*32, r*32}}, type="resource"}) do
ent.destroy()
end
local chunks = {}
for x=-r, r do
for y=-r, r do
chunks[#chunks + 1] = {x, y}
end
end
surface.regenerate_entity(entities, chunks)