[HL2DM] Prehooking entity kill

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
VinciT
Senior Member
Posts: 331
Joined: Thu Dec 18, 2014 2:41 am

[HL2DM] Prehooking entity kill

Postby VinciT » Tue Aug 16, 2016 3:30 am

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?
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2DM] Prehooking entity kill

Postby satoon101 » Tue Aug 16, 2016 4:03 am

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.
Image
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: [HL2DM] Prehooking entity kill

Postby L'In20Cible » Tue Aug 16, 2016 8:10 am

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
User avatar
VinciT
Senior Member
Posts: 331
Joined: Thu Dec 18, 2014 2:41 am

Re: [HL2DM] Prehooking entity kill

Postby VinciT » Tue Aug 16, 2016 4:08 pm

OnEntityDeleted works great. Thanks guys!

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 130 guests