Reference to LuaEntity of type "character-corpse" in "on_player_died" event data
Posted: Sun May 10, 2020 11:16 pm
I suggest to add a reference to the LuaEntity of the character-corpse that is associated with a character death, to the event data of "on_player_died". nil if for some reason no character-corpse was created. I can imagine, that the engine has that reference at hand, when the event fires.
Currently I can find a character-corpse associated with an on_player_died event by using find_entities_filtered at the position of death and then verifying matching player indexes and tick of death. But - always looking at possible extreme cases - there can be an arbitrary (large) number of character-corpses at that location (imagine idle players dieing at spawn over and over again).
A reference or some other unique identifier via which the LuaEntity for the character-corpse associated with that death event can be retreived at once without searching and iterating would be very convenient, unmistakable and fast.
Currently I can find a character-corpse associated with an on_player_died event by using find_entities_filtered at the position of death and then verifying matching player indexes and tick of death. But - always looking at possible extreme cases - there can be an arbitrary (large) number of character-corpses at that location (imagine idle players dieing at spawn over and over again).
A reference or some other unique identifier via which the LuaEntity for the character-corpse associated with that death event can be retreived at once without searching and iterating would be very convenient, unmistakable and fast.