Add a "blueprint as" property

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
GotLag
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat May 03, 2014 3:32 pm
Contact:

Add a "blueprint as" property

Post by GotLag »

Is it feasible to add a field to prototypes to allow that entity/tile to be replaced with another entity/tile in blueprints? There are times when a mod needs to swap out an entity at some point after it's built, and this currently breaks blueprints made after that swap.

Three example uses:
  • Make all vanilla land tiles blueprint as landfill, so a blueprint can be made of any part of a factory and automatically include landfill through the simple expedient of ticking "include tiles", instead of having to be blueprinted on an area that's already been entirely landfilled.
  • Allow auto-generated custom locomotive entities from this mod to blueprint as the normal, buildable versions.
  • A mod that adds different versions of rails for concreted/paved surfaces and swaps them out automatically as the rails are built or tiles are added/removed, but uses the same rail item to build them all

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Add a "blueprint as" property

Post by DaveMcW »

The workaround is to do a search/replace in events.on_player_configured_blueprint. But I agree a property would be very convenient.

GotLag
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: Add a "blueprint as" property

Post by GotLag »

I seem to be missing something because I can't work out where to find/replace in that situation. All that event gives me is the player index, and I don't see anything in the LuaPlayer API that is useful here.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Add a "blueprint as" property

Post by DaveMcW »

The blueprint is in player.cursor_stack

GotLag
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: Add a "blueprint as" property

Post by GotLag »

Okay, that also works with copy-paste if you use events.on_player_setup_blueprint and make the appropriate checks, thanks.

Still, the entities/tiles need to have (hidden, non-craftable) items defined to place them for them to be selectable for blueprints/copying

Post Reply

Return to “Modding interface requests”