TF2-DMB / CBaseNPC

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

Add CTakeDamageInfo natives to use with TakeDamage #48

Closed KitRifty closed 10 months ago

KitRifty commented 10 months ago

This PR adds natives for creating and applying custom CTakeDamageInfo parameters to entities using CBaseEntity::TakeDamage(). Plugins can use the GetGlobalDamageInfo native to specify custom parameters for use in TakeDamage.

CBaseEntity::TakeDamage was used over CBaseEntity::OnTakeDamage because it checks for damage filters and applies damage scaling before OnTakeDamage is called. In addition, not only is it used across the SDK, it's the recommended way of dealing damage to entities anyways. On the other hand, SDKHooks_OnTakeDamage bypasses that and calls CBaseEntity::OnTakeDamage directly.

Some other miscellaneous changes:

Mikusch commented 10 months ago

CTakeDamageInfo.SetDamageType is also missing its parameter in the include