[2.0.41] pre_entity_died event

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 113
Joined: Tue Feb 06, 2024 5:18 am
Contact:

[2.0.41] pre_entity_died event

Post by hgschmie »

There are "pre" events for all "mining" ways in which an entity can be removed:

- on_pre_player_mined_item -> on_player_mined_entity
- on_robot_pre_mined -> on_robot_mined_entity
- on_space_platform_pre_mined -> on_space_platform_mined_entity

However, there is no pre-event for on_entity_died. So in some of my mods, I now have to deal with "entity gets removed" events differently for the "mined" and "died" events (do pre-reqs in _pre_..._mined and on_entity_died and the actual op in _..._mined and on_post_entity_died).

Would it be possible to have a "on_pre_entity_died" event similar to the pre_..._mined events that triggers before an entity actually dies?
Rseding91
Factorio Staff
Factorio Staff
Posts: 15224
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.41] pre_entity_died event

Post by Rseding91 »

The current entity died event is actually a pre-died event. Because once something is actually dead, we can't make a lua event for it (since it's dead). In the current died event if you set the health back to a non-zero value it doesn't actually die.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Modding interface requests”