Change on_pre_build for power poles built by dragging

Things that we aren't going to implement
Post Reply
PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Change on_pre_build for power poles built by dragging

Post by PFQNiet »

When dragging a power pole, on_pre_build is fired for every position that the player's cursor moves over, without regard for whether a power pole is actually built. There doesn't appear to be any way in Lua to detect whether the placement will result in a power pole being built.

I can work around this by "delaying" the event and checking if an entity was actually created, but this is a very dirty hack and it would be nice to have a "proper" way to detect this.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13175
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Change on_pre_build for power poles built by dragging

Post by Rseding91 »

on_pre_build is exactly what this is intended to cover. If you want to know when something is actually built you listen to https://lua-api.factorio.com/latest/eve ... ilt_entity

There are any number of reasons why building may not happen after pre_build is fired.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Won't implement”