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

Add CTakeDamageInfo natives to use with TakeDamage #48

Closed KitRifty closed 8 months ago

KitRifty commented 8 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 8 months ago

CTakeDamageInfo.SetDamageType is also missing its parameter in the include