Blueprint API Updating/Creating Consistency

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Hares
Fast Inserter
Fast Inserter
Posts: 127
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Blueprint API Updating/Creating Consistency

Post by Hares »

TL;DR
Blueprint initial creation should behave the same way as the blueprint updating.
What?
Currently, the on_player_setup_blueprint event behaves differently when the blueprint is created normal way, when it's created without confirmation, and/or when it's updated.
Event Handler Example
As you can see in the example above, all cases are handled by different branches which are executed each time a player selects a blueprint, and handling the update even requires listening on the on_gui_closed event which should have nothing to do with the blueprints.

Possible solutions:
  1. Provide the modifiable blueprint entity for the event payload
  2. Provide a new event, on_entity_blueprinted, which is invoked when a specific entity (usually, by prototype ID) is blueprinted by either way
Why?
Quite often I can see that some modded entities either explicitly or implicitly don't work on updated blueprints.
Some Examples
Since the point of the 2.0 upcoming update is the consistency between different use cases (see: FFF#380), I see a great opportunity to refactor that part of code and make both modders & developers lives easier.

Post Reply

Return to “Modding interface requests”