No event called on destruction of ghost entity

Bugs that are actually features.
wakjah
Burner Inserter
Burner Inserter
Posts: 12
Joined: Mon Jun 05, 2017 9:56 pm
Contact:

No event called on destruction of ghost entity

Post by wakjah »

I have been playing with the event API for item destruction and I have the events registered for entity destruction.

I can see that when I place a ghost entity and then mine it, some of these events are called - specifically, on_preplayer_mined_item.

If I use the deconstruction planner to remove the ghost entity, however, none of these events are called.

I have the following events registered to listen for destruction of an entity:

Code: Select all

script.on_event(defines.events.on_preplayer_mined_item, on_preplayer_mined_item)
script.on_event(defines.events.on_player_mined_item, on_player_mined_item)
script.on_event(defines.events.on_robot_pre_mined, on_robot_pre_mined)
script.on_event(defines.events.on_robot_mined, on_robot_mined)
script.on_event(defines.events.on_entity_died, on_entity_died)
script.on_event(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
and in each of the handlers I print a log message indicating the event that occurred.

Expected:
- One of these events is called when a ghost entity is destroyed with the deconstruction planner
- Consistent with what happens when a user mines the entity

What happens:
- None of them are called
Rseding91
Factorio Staff
Factorio Staff
Posts: 15679
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: No event called on destruction of ghost entity

Post by Rseding91 »

Ghosts selected with the deconstruction planner fire no events because nothing happens to them except them being deleted. That's working as intended.

The player doesn't mine them and they aren't removed by robots they simply go away.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”