on_post_built event, especially for blueprints

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
sparr
Smart Inserter
Smart Inserter
Posts: 1513
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

on_post_built event, especially for blueprints

Post by sparr »

When the player places a blueprint, one on_pre_built event fires, then one on_built_entity for each ghost that the blueprint creates.
This request is for an event that fires at the end of that process, indicating that the build process for the blueprint is finished. The event could fire for non-blueprints, but it seems less useful in those cases.

PS: This is an XY post. The underlying problem/goal here is finding a way to prevent https://mods.factorio.com/mod/automatic ... connectors from building a pipe ghost between two new underground pipe ghosts in the middle of a blueprint placement. The broader inquiry into how to solve that sort of problem with that mod is at viewtopic.php?t=129325
Rseding91
Factorio Staff
Factorio Staff
Posts: 15749
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: on_post_built event, especially for blueprints

Post by Rseding91 »

I can see the utility in such an event: after all the blueprint entities/actions are finished. The only issue I can see is knowing which entities it was related to since the game has no way to make that association now. It would be up to anyone listening to it to simply flush everything it had queued between pre-built and it running - treat them all as part of that action.
If you want to get ahold of me I'm almost always on Discord.
sparr
Smart Inserter
Smart Inserter
Posts: 1513
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: on_post_built event, especially for blueprints

Post by sparr »

That would be my strategy. Set a flag in on_pre_built, check the flag in on_built_entity, clear the flag in on_post_built.
robot256
Smart Inserter
Smart Inserter
Posts: 1213
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: on_post_built event, especially for blueprints

Post by robot256 »

Suggestion to solve the original problem:
Check the last_user or the just built entity.
Check the cursor_stack of that player.
If it's not an underground pipe, don't do anything.
That way if they are holding a blueprint, it won't trigger.
sparr
Smart Inserter
Smart Inserter
Posts: 1513
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: on_post_built event, especially for blueprints

Post by sparr »

I only don't want to connect entities within the same blueprint. I still want to connect an underground pipe in a blueprint to an underground pipe outside the blueprint.

Also another mod can modify their cursor stack before I check it.

PS: And I'd really prefer to have discussions of the larger problem over in the thread for that. viewtopic.php?t=129325
Post Reply

Return to “Modding interface requests”