Page 1 of 1

[HL2DM] Prehooking entity kill

Posted: Tue Aug 16, 2016 3:30 am
by VinciT
I'm trying to detach a child entity from the parent entity before the parent entity gets removed.
Is it possible to prehook entity kill/remove?

Re: [HL2DM] Prehooking entity kill

Posted: Tue Aug 16, 2016 4:03 am
by satoon101
I am not sure if this gets called before or after the entity is actually removed, but you can try and test it yourself:
http://wiki.sourcepython.com/developing ... itydeleted

If that doesn't work, you can always use an EntityPreHook on remove.

Re: [HL2DM] Prehooking entity kill

Posted: Tue Aug 16, 2016 8:10 am
by L'In20Cible
OnEntityDeleted is called before, giving you full access to the index/Entity instance. :smile:

As a side note, OnEntityCreated was firing too early, before the networkable instance being linked to the edict (making our conversions crying) thus why we manually link it before calling the registered callbacks: https://github.com/Source-Python-Dev-Te ... n.cpp#L496

Re: [HL2DM] Prehooking entity kill

Posted: Tue Aug 16, 2016 4:08 pm
by VinciT
OnEntityDeleted works great. Thanks guys!