[0.15.23] Deconstruction not triggering events

Things that we aren't going to implement
321freddy
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Sep 23, 2016 10:16 pm
Contact:

[0.15.23] Deconstruction not triggering events

Post by 321freddy »

So two things:
1. When an entity is deconstructed by script with LuaEntity.order_deconstruction the event on_marked_for_deconstruction is not triggered even though the documentation says it is.

2. When a player mines an entity-ghost the on_preplayer_mined_item event is triggered. This is not the case when he deconstructs ghosts with a deconstruction planner (even though it is basically the same action). Neither on_preplayer_mined_item or on_marked_for_deconstruction is triggered and once on_player_deconstructed_area is triggered the ghosts are already destroyed.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14300
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15.23] Deconstruction not triggering events

Post by Rseding91 »

Thanks for the report. I've fixed the no-event when marked for deconstruction. The ghost(s) not firing events is intended. Ghosts aren't mined/processed - they're simply destroyed and cease to exist.
If you want to get ahold of me I'm almost always on Discord.
321freddy
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Sep 23, 2016 10:16 pm
Contact:

Re: [0.15.23] Deconstruction not triggering events

Post by 321freddy »

Rseding91 wrote:Ghosts aren't mined/processed
But the is on_preplayer_mined_item is fired when a player destroys a ghost by right clicking it. It is not fired when selecting a ghost with deconstruction planner which is inconsistent.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14300
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15.23] Deconstruction not triggering events

Post by Rseding91 »

321freddy wrote:
Rseding91 wrote:Ghosts aren't mined/processed
But the is on_preplayer_mined_item is fired when a player destroys a ghost by right clicking it. It is not fired when selecting a ghost with deconstruction planner which is inconsistent.
There's no inherit event that's fired when something is selected by blueprints or the deconstruction planner. When an entities state is changed from not-marked to marked or from marked to not-marked it fires an event - which isn't directly related to the deconstruction planner selecting the entities. Similar to how an entity being built destroys ghost entities without firing any event.

Now, I could add some event when a ghost is about to be deleted as a result of being selected by the deconstruction planner but it wouldn't go in the on-deconstruction-ordered event.

The main problem is figuring out what to name the event...
If you want to get ahold of me I'm almost always on Discord.
321freddy
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Sep 23, 2016 10:16 pm
Contact:

Re: [0.15.23] Deconstruction not triggering events

Post by 321freddy »

Rseding91 wrote:Now, I could add some event when a ghost is about to be deleted as a result of being selected by the deconstruction planner but it wouldn't go in the on-deconstruction-ordered event.

The main problem is figuring out what to name the event...
That would be perfect. What I originally wanted in my mod was to free some memory which was saved using the ghosts unit number which was useless as soon as the ghost became invalid (therefore I needed the events).

So ideally it should be an event which is fired before a ghost is destroyed in any way and provides the ghost as a parameter.
Here are some naming suggestions:
on_pre_ghost_destroyed, on_pre_player_destroyed_ghost, on_ghost_became_invalid, on_ghost_vanished

Thanks a lot for the quick fix and your time :)
Post Reply

Return to “Won't implement”