Event for trying to place a blueprint.

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Lukas0120
Inserter
Inserter
Posts: 23
Joined: Fri Jun 20, 2014 11:24 am
Contact:

Event for trying to place a blueprint.

Post by Lukas0120 »

I want to make a mod that automatically places ghost entities in a blueprint placed on water after landfill has been placed or automatically replaces the blueprint once landfill is build.
To do this I need an event to detect when there is an attempt to place a blueprint, this event needs to give me:
1. the blueprint that was attempted to be placed
2. where it was supposed to be placed
3. If the blueprint was placed sucefully or if anything was blocking it, if something was blocking I need to know what it's blocked by (water, other buildings, ...)
Ideally i'd also like to get info, that info isn't required for what I need but would allow me to make some things nice(making it easier to for example place dummy entitys on the water instead of just reapllying the blueprint repeatably)
4. Entitles Placed by the blueprint
5. Blocked Entitles and what blocked them.

Alternativly an event that get's raised when you try to build something (even if it fails) and tells you want you were trying to build, where you where trying to build it and why it got blocked would also work.

mami
Burner Inserter
Burner Inserter
Posts: 18
Joined: Fri Oct 21, 2022 12:27 am
Contact:

Re: Event for trying to place a blueprint.

Post by mami »

^^^ This could also be a solution my current problem with the factorio api viewtopic.php?f=28&t=103934. I need some kind of event when a blueprint is pasted over an existing entity.

curiosity
Filter Inserter
Filter Inserter
Posts: 328
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Event for trying to place a blueprint.

Post by curiosity »


User avatar
ZwerOxotnik
Fast Inserter
Fast Inserter
Posts: 114
Joined: Tue Dec 19, 2017 6:58 pm
Contact:

Re: Event for trying to place a blueprint.

Post by ZwerOxotnik »

I have performance issues with on_built_entity and on_pre_build in multiplayer.
set_event_filter isn't solution because my filters are too big, and some mods/scenarios don't need filters and blueprints can cause too many events for short time.
I don't know any way to limit blueprints partially except to change cursor stack and get entities from blueprint, but it doesn't seem to be a good solution.

Some players spam blueprints and there's no way to detect and react to spam in time with Lua scripts, currently. It can be used to kick out players from servers, because some of them can't keep up in time.

(I decided to limit players using permissions. defines.input_action.build helps. result: https://mods.factorio.com/mod/anti_blueprint_spam)

Post Reply

Return to “Modding interface requests”