Page 1 of 1

[2.0.41] pre_entity_died event

Posted: Sun Mar 16, 2025 5:55 am
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?

Re: [2.0.41] pre_entity_died event

Posted: Mon Mar 17, 2025 12:39 pm
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.