[Solved]Using autoplace to make a tile appear under a resource?

Place to get help with not working mods / modding interface.
User avatar
Fishbus
Inserter
Inserter
Posts: 31
Joined: Sat Sep 28, 2024 8:20 pm
Contact:

[Solved]Using autoplace to make a tile appear under a resource?

Post by Fishbus »

Heya,

I'm trying to achieve a look that is to create a tile under the same location as a certain resource when generating chunks.

e.g.: creating a stone-tile under iron-ore resources.

My current thought is to perhaps have a tile have the exact same autoplace function as the resource in question, but I can't quite wrap my little lizard brain around it. It doesn't need to be precise, it can be roughly the same.

NOTE: I'd like to do it that way, not the other way around (i.e. not using tile restriction on an ore autoplace to only appear on this tile).
Also without using runtime scripts.

Cheers
Last edited by Fishbus on Fri Jun 27, 2025 10:02 pm, edited 1 time in total.
robot256
Smart Inserter
Smart Inserter
Posts: 1225
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Using autoplace to make a tile appear under a resource?

Post by robot256 »

IIRC, I discovered by accident that Aquilo uses an effect trigger event to create ice under it. (I had copied it and somehow ice was spawning on Nauvis, traced back to the build effect trigger on the resource entity.) That sounds like exactly what you want.
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
User avatar
Fishbus
Inserter
Inserter
Posts: 31
Joined: Sat Sep 28, 2024 8:20 pm
Contact:

Re: Using autoplace to make a tile appear under a resource?

Post by Fishbus »

robot256 wrote: Fri Jun 27, 2025 8:34 pm IIRC, I discovered by accident that Aquilo uses an effect trigger event to create ice under it. (I had copied it and somehow ice was spawning on Nauvis, traced back to the build effect trigger on the resource entity.) That sounds like exactly what you want.
Thank you!

Investigating down this path, lead me to make a function that is just the ticket:
(based on the aquilo one, but allowed to be customizable more easily)

Code: Select all

local function create_tiles(tilename, rad)
  return {
		type = "direct",
		action_delivery =
		{
			type = "instant",
			target_effects =
			{
				{
					type = "set-tile",
					tile_name = tilename,
					radius = rad or 1,
				}
			}
		}
	}
end
in the resource entry I just put this:
created_effect = create_tiles("grass-2", 2.5),
Natha
Filter Inserter
Filter Inserter
Posts: 263
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: [Solved]Using autoplace to make a tile appear under a resource?

Post by Natha »

Alternatively, you can use the same noise expression for your tile autoplace
Post Reply

Return to “Modding help”