Page 1 of 1
[2.0.12] on_object_destroyed fires after on_built_entity for quality upgraded entities
Posted: Tue Oct 29, 2024 9:52 am
by Quezler
this caught me off guard, i had code that checks for the presence of a compound entity (or ghost) to adopt inside the on_built_entity hook, and i have on_object_destroyed handling to clear up the old compound entities, but in the case of upgrading the quality of something the upgraded quality fired it's on_built_entity hook before the previous quality triggered its deathrattle, which caused it to clean up its own internal entity even though the upgraded entity already started using it, modded my way around it by also checking for quality but it should probably be documented:
https://github.com/Quezler/glutenfree/c ... ebe035eac0
Re: [2.0.12] on_object_destroyed fires after on_built_entity for quality upgraded entities
Posted: Tue Oct 29, 2024 10:20 am
by curiosity
That's working as described. on_object_destroyed is raised "eventually", just like the old on_entity_destroyed, and the docs say it. on_built_entity is raised immediately.
This likely has nothing to do with quality either, a regular fast replace would be the same.
Re: [2.0.12] on_object_destroyed fires after on_built_entity for quality upgraded entities
Posted: Tue Oct 29, 2024 10:32 am
by Quezler
> Depending on when a given object is destroyed, this event will be fired at the end of the current tick or at the end of the next tick.
fair, i guess it does kinda say that if you read between the lines, it doesn't really say its queued so i always interpreted it as "it'll fire when the object is removed, and the object being removed can be removed anywhere during the tick cycle"
Re: [2.0.12] on_object_destroyed fires after on_built_entity for quality upgraded entities
Posted: Tue Oct 29, 2024 11:00 am
by curiosity
It does mention end of tick, at the same time you are not limited to when you can destroy objects. I think, it's clear enough.
Re: [2.0.12] on_object_destroyed fires after on_built_entity for quality upgraded entities
Posted: Mon Dec 02, 2024 10:24 am
by Therenas
Thanks for the discussion, I tried to make it a bit clearer for the next release.