TF2-DMB / CBaseNPC

Provides a friendly interface for plugins to use in order to create custom NPCs on the game Team Fortress 2
36 stars 5 forks source link

Destroy NextBot interfaces before detaching datamap #25

Closed KitRifty closed 2 years ago

KitRifty commented 2 years ago

While using a CBaseNPC-derived entity with a custom datamap + the behavior system, removing the entity while an Action is running would occasionally throw an error about missing properties from the datamap despite being defined. This is because when an entity is destroyed, the intention interface is deleted after the datamap has been detached from the entity, resulting in reading the wrong datamap. This PR ensures that the NextBot interfaces are destroyed first before the datamap is detached, so that Actions can perform any cleanup and refer to the datamap before destruction.