Page 1 of 1

Event when biters despawn?

Posted: Mon Mar 06, 2023 1:44 pm
by repne-scasb
Hi! Is there an event that fires when a biter despawns? (or when it is removed from the world in any other way.) I need it to remove the biter from some list in my mod.
Currently I listen for on_entity_died (with type unit), but I don't think that event is fired in this case. Should I instead use register_on_entity_destroyed and listen for on_entity_destroyed or does that also not fire here?

Re: Event when biters despawn?

Posted: Mon Mar 06, 2023 2:35 pm
by Xorimuth
Pretty sure that register_on_entity_destroyed + on_entity_destroyed is the way to go here.

Re: Event when biters despawn?

Posted: Mon Mar 06, 2023 2:50 pm
by repne-scasb
Xorimuth wrote: Mon Mar 06, 2023 2:35 pm Pretty sure that register_on_entity_destroyed + on_entity_destroyed is the way to go here.
I think you might be right after all, I thought it didn't fire but maybe it does. Do you know any way to reproduce, i.e. get biters to despawn?

EDIT: I waited along on a group of biters without spawner and eventually they all despawned, indeed firing on_entity_destroyed (but not on_entity_died).