Blueprint Events
Posted: Mon Apr 20, 2015 10:56 am
Hi, I'd like to request some way to tweak blueprints when they're first created.
Use case: In agri-mod, I use multiple entities to represent different stages of trees, and those entities cannot be directly placed. I'd like to set things up so that mid-stage tree entities get replaced with seedlings in blueprints the player creates.
Also I have some utility entities that exist to give the effect of construction bots harvesting certain types of crops implemented as resources, and those utility entities shouldn't show up in the blue prints. However the clover patches should (perhaps replaced with a different entity type), despite being resources.
Implementation ideas: One possibility would be an event that gets called when the blueprint is created, passing code some mutable table of blueprint entities (vaguely like ItemStack's getblueprintentities()), and the game-world bounds of the blueprint. After the event has been triggered, the table would be inspected, and the player presented with the resulting blueprint. This has the advantage of allowing mods to accomplish almost whatever they want.
Perhaps a simpler way to accomplish what I need would be to add some property to prototypes that indicates the entity would be replaced with a different type in blueprints. However, in this case it'd be important to be able to set this on entities that cannot contain a force (such as a trees), and that don't normally show up in blueprints (such as trees or resources).
Use case: In agri-mod, I use multiple entities to represent different stages of trees, and those entities cannot be directly placed. I'd like to set things up so that mid-stage tree entities get replaced with seedlings in blueprints the player creates.
Also I have some utility entities that exist to give the effect of construction bots harvesting certain types of crops implemented as resources, and those utility entities shouldn't show up in the blue prints. However the clover patches should (perhaps replaced with a different entity type), despite being resources.
Implementation ideas: One possibility would be an event that gets called when the blueprint is created, passing code some mutable table of blueprint entities (vaguely like ItemStack's getblueprintentities()), and the game-world bounds of the blueprint. After the event has been triggered, the table would be inspected, and the player presented with the resulting blueprint. This has the advantage of allowing mods to accomplish almost whatever they want.
Perhaps a simpler way to accomplish what I need would be to add some property to prototypes that indicates the entity would be replaced with a different type in blueprints. However, in this case it'd be important to be able to set this on entities that cannot contain a force (such as a trees), and that don't normally show up in blueprints (such as trees or resources).