[0.16.15] regenerate_entity() ignores runtime map settings

We are aware of them, but they have low priority. We have more important things to do. They go here in order not to take space in the main bug thread list.
User avatar
Dustine
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Tue Mar 31, 2015 4:52 pm
Contact:

[0.16.15] regenerate_entity() ignores runtime map settings

Post by Dustine »

When you change the map_gen_settings of a surface (I've only experimented with autogen_control sizes), regenerate_entity doesn't seem to respect these new settings.

Easiest way to replicate it that I found was:
  • Create a small 256x256 world with iron ore gen size set to none.
    Image
  • Check how much iron there is and what the iron ore gen size is. It should be "none" and "0", respectively.

    Code: Select all

    game.print("Iron gen: "..game.surfaces.nauvis.map_gen_settings.autoplace_controls["iron-ore"].size);
    game.print("Iron count: "..game.surfaces.nauvis.count_entities_filtered{name="iron-ore"})
  • Change the iron gen size to normal. The console should now print "Iron gen: normal." (ran the same code as in the previous step).

    Code: Select all

    local settings=game.surfaces.nauvis.map_gen_settings;
    settings.autoplace_controls["iron-ore"].size="normal";
    game.surfaces.nauvis.map_gen_settings=settings;
    game.print("Iron gen: "..game.surfaces.nauvis.map_gen_settings.autoplace_controls["iron-ore"].size)
  • Run surface.regenerate_entity() and wait a bit. Count how much iron ore there is, which it'll be 0 still.

    Code: Select all

    for _, e in pairs(game.surfaces.nauvis.find_entities()) do e.destroy() end;
    game.surfaces.nauvis.regenerate_entity();
    Image
  • Finally, delete all chunks so they are recreated, and count how much ore you have, a non-zero amount now. If you're using the seed I showed above, it'll be 738.

    Code: Select all

    for chunk in game.surfaces.nauvis.get_chunks() do game.surfaces.nauvis.delete_chunk(chunk) end
    Image
Edit: forgot to delete entities before running regenerate, but the bug still occurs when I do so.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14264
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.16.15] regenerate_entity() ignores runtime map settings

Post by Rseding91 »

Thanks for the report. I'm not sure what's best here: you can use regenerate_entity with an entity that doesn't exist in the surface settings so it can't always use those values.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Dustine
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Tue Mar 31, 2015 4:52 pm
Contact:

Re: [0.16.15] regenerate_entity() ignores runtime map settings

Post by Dustine »

Rseding91 wrote:Thanks for the report. I'm not sure what's best here: you can use regenerate_entity with an entity that doesn't exist in the surface settings so it can't always use those values.
Um, true, the sticking point for me is the inconsistent behaviour with how deleting chunks respect the settings and creates stuff using them, there are cases (I mean, that's how I found it) where I can't afford to delete a chunk to recreate stuff in it based on new settings (like toggling back on an ore resource that the player disabled on map gen). But I hadn't thought on entities outside said settings...
Post Reply

Return to “Minor issues”