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 more Nav natives #18

Closed KitRifty closed 2 years ago

KitRifty commented 2 years ago

Fixes:

Additions:

One thing I'm not sure of is handling SMPathCost. Since this exposes NavAreaBuildPath as the TheNavMesh.BuildPath native, it requires a generic path cost function, but NavPathCostFunctor typeset has a INextBot argument. I figured that to ensure backwards compatibility, I kept the typeset the same, and in BuildPath's SMPathCost object, I pass nullptr as the INextBot argument. Added PathFollowerCostFunctor.

Tested and working on Windows.

Kenzzer commented 2 years ago

Good job on exposing the rest of the natives. As for the problem you raise regarding NavPathCostFunctor, it comes from CBaseNPC early days, when extension used to be a very small library, only focused on exposing pathfollower to its plugin.

Thankfully NavPathCostFunctor is a typeset, and there shouldn't be many projects out there making use of it. It should be safe to rename NavPathCostFunctor to PathFollowerNavPathCostFunctor, without breaking backwards compatibility, and make a new NavPathCostFunctor without INextBot param.

KitRifty commented 2 years ago

I’ll try that then, thanks. PathFollowerNavPathCostFunctor seems like a mouthful, though. Would PathFollowerCostFunctor be sufficient instead?