[togos][0.16.16] Regenerate oil wells changes their position

This subforum contains all the issues which we already resolved.
Post Reply
blueblue
Long Handed Inserter
Long Handed Inserter
Posts: 75
Joined: Tue Apr 11, 2017 7:39 pm
Contact:

[togos][0.16.16] Regenerate oil wells changes their position

Post by blueblue »

I'm regenerating resources on my map, using the following command:

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)
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.
unique_2 on discord and mod portal

TOGoS
Former Staff
Former Staff
Posts: 93
Joined: Fri Jun 24, 2016 2:29 pm
Contact:

Re: [togos][0.16.16] Regenerate oil wells changes their position

Post by TOGoS »

Great bug report, thank you! And have confirmed.

May be related to viewtopic.php?t=57348

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [togos][0.16.16] Regenerate oil wells changes their position

Post by posila »

Hi, what is your purpose of running the command? We use regenerate_entity() to generated new resource on maps migrated from versions in which those resources didn't exist yet, so we don't mind it doesn't exactly match map generator. I am asking because we are deciding how far do we want to go to make it exactly match map generator. It might be possible that your use case is not suitable for this, because if the map was migrated from any previous version (even minor updates), regenerate_entity() won't be guaranteed to match what map generator did in that version. Even worse if it is ran in hand made scenario.

blueblue
Long Handed Inserter
Long Handed Inserter
Posts: 75
Joined: Tue Apr 11, 2017 7:39 pm
Contact:

Re: [togos][0.16.16] Regenerate oil wells changes their position

Post by blueblue »

I just want to reset resources to their original state on the same version of the map gen. My original use case was planning a speedrun, with the command I'd see if a specific factory actually lasts as long as I need it to. I can see that this is not a particularly important use case. A similar workflow might be useful in developing scenario maps with NPC factories :)
unique_2 on discord and mod portal

Post Reply

Return to “Resolved Problems and Bugs”