resource_autoplace_all_patches noise-expressions with identical regular_patch_set_index influence each other?

Place to get help with not working mods / modding interface.
Keithen
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Jul 04, 2022 7:36 pm
Contact:

resource_autoplace_all_patches noise-expressions with identical regular_patch_set_index influence each other?

Post by Keithen »

My initial goal was to have a small resource patch in the center(-ish) of another resource patch. I figured I could make them use the same location by ensuring that their spot_noise expressions use the same skip_offset parameter. While trying/debugging this approach I noticed the following:

With this code in a data.lua (no other code anywhere else, no other mods. Game version 2.0.66):

Code: Select all

local copper = data.raw["noise-expression"]["default-copper-ore-patches"]
copper.expression = copper.expression
	:gsub("regular_rq_factor = 0.11", "regular_rq_factor = 0.03")
	:gsub("regular_patch_set_index = 1", "regular_patch_set_index = 0")
And starting a new game, I would expect iron patches to be the same size as usual, with small copper patches in the middle (or very little/no copper, if the RNG got unlucky, I guess). Instead I see the following:
smol_iron.png
smol_iron.png (2.2 MiB) Viewed 384 times
It looks like both the iron and copper have been shrunk. A normal iron patch should have like 4 times that radius (and be less regular and all that).

So it looks like changing the index in the copper noise expression somehow influenced the iron noise expression or something? No idea if that's a bug, missing documentation, or just me misunderstanding something big time.

I would love some ideas on how to debug this, or just... any solution really.
Natha
Filter Inserter
Filter Inserter
Posts: 282
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: resource_autoplace_all_patches noise-expressions with identical regular_patch_set_index influence each other?

Post by Natha »

You should use some regex for the string which will be replaced. In the base game, the rq values are 1.10, not 0.11.

Did you manage to generate copper at the same spots as iron, but with iron turned off?
Keithen
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Jul 04, 2022 7:36 pm
Contact:

Re: resource_autoplace_all_patches noise-expressions with identical regular_patch_set_index influence each other?

Post by Keithen »

Natha wrote: Sun Sep 14, 2025 4:25 pm You should use some regex for the string which will be replaced. In the base game, the rq values are 1.10, not 0.11.
Whoops, forgot to escape te ., tho that shouldn't change anything. resource-autoplace.lua resource_autoplace_settings divides the
regular_rq_factor_multiplier by 10, so 0.11 should be correct. That's what dump-data says anyways.
Natha wrote: Sun Sep 14, 2025 4:25 pm Did you manage to generate copper at the same spots as iron, but with iron turned off?
What do you mean by "turned off"?
Natha
Filter Inserter
Filter Inserter
Posts: 282
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: resource_autoplace_all_patches noise-expressions with identical regular_patch_set_index influence each other?

Post by Natha »

Keithen wrote: Sun Sep 14, 2025 7:39 pm What do you mean by "turned off"?
Disable iron before generating the map
Keithen
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Jul 04, 2022 7:36 pm
Contact:

Re: resource_autoplace_all_patches noise-expressions with identical regular_patch_set_index influence each other?

Post by Keithen »

Huh, I've never noticed that it's possible to turn off a resource before :D.

Anyhow, when I turn off Iron, I get small circular copper patches, roughly of the dimensions shown in the screenshot.
If instead I turn off copper however, I get perfectly normal iron patches.
Post Reply

Return to “Modding help”