Page 1 of 1

Detect placement of blueprint

Posted: Thu Mar 25, 2021 1:37 am
by PFQNiet
What is the proper way to respond to a blueprint being placed? I would like to have a table of ghosts to do stuff with.

Would this be done as just a large number of entity creation events where the entity is a ghost? If so, how would I tell the difference between an item holding a single entity, or shift-clicking to place a ghost?

What about copy-paste? Is this just a temporary blueprint that can be handled in the same way?

Re: Detect placement of blueprint

Posted: Thu Mar 25, 2021 4:53 am
by DaveMcW
PFQNiet wrote:
Thu Mar 25, 2021 1:37 am
Would this be done as just a large number of entity creation events where the entity is a ghost?
Yes. If you need all ghosts in one table, you can collect them in on_built_entity, store them in a table, and process/delete the table in on_tick.
PFQNiet wrote:
Thu Mar 25, 2021 1:37 am
If so, how would I tell the difference between an item holding a single entity, or shift-clicking to place a ghost?
Check player.cursor_stack to see what they used.

Re: Detect placement of blueprint

Posted: Sat Apr 10, 2021 12:59 pm
by eradicator
DaveMcW wrote:
Thu Mar 25, 2021 4:53 am
PFQNiet wrote:
Thu Mar 25, 2021 1:37 am
Would this be done as just a large number of entity creation events where the entity is a ghost?
Yes. If you need all ghosts in one table, you can collect them in on_built_entity, store them in a table, and process/delete the table in on_tick.
You should keep seperate tables for each player in case several players build simultaneously.