The purpose of this PR is to refactor the include file structure and to add some natives to make some methodmaps more complete and useful. This also fixes bugs that were present with some natives, and changes some entirely.
The new file structure is as follows:
includes/
cbasenpc/
nextbot/
behavior.inc
NextBotAction
NextBotActionFactory
body.inc
IBody
intention.inc
IIntention
knownentity.inc
CKnownEntity
locomotion.inc
ILocomotion
NextBotGroundLocomotion
path.inc
Segment
CursorData
Path
PathFollower
ChasePath
DirectChasePath
Path_Cost
Path_FilterIgnoreActors
Path_FilterOnlyActors
vision.inc
IVision
tf/
nav.inc
TFNavAttributeType
CTFNavArea
baseanimating.inc
CBaseAnimating
baseanimatingoverlay.inc
CBaseAnimatingOverlay
CAnimationLayer
CAnimationOverlay (deprecated)
basecombatcharacter.inc
CBaseCombatCharacter
baseentity.inc
CBaseEntity
entityfactory.inc
CEntityFactory
matrix.inc
nav.inc
CNavMesh
CNavArea
CTNavArea
nextbot.inc
TraceFilterActors
INextBotEventResponder
INextBotComponent
INextBot
cbasenpc.inc
CExtNPC
CBaseNPC
CNPCs
Fixes:
Fix parameter error for OnAnimationEvent typeset
Squash warning of TheNavMesh not being used
Fix using Continue instead of TryContinue in Scout's OnInjured event callback
Fix ILocomotion.ClimbUpToLedge getting entity from wrong parameter
Additions:
Add MatrixPosition stock
Add include guards to util.inc
Add TEAM_ANY define
Add some commonly used entity natives to CBaseEntity
Add KeyValue and entity IO method aliases
Add MyNextBotPointer, GetBaseAnimating, and MyCombatCharacterPointer natives
Should CBaseNPC_GetNextBotOfEntity be deprecated?
Add flag setter methods to complement CBaseEntity.GetFlags
Add IsCombatCharacter native
This was defined as a native instead of a stock to get around methodmap compilation errors.
Add aliases to stocks defined in entity_prop_stocks.inc
Add Get/SetEntProp native aliases
Add CAnimationLayer methodmap
This deprecates the CAnimationOverlay methodmap. This change aims to enforce consistency to the same structure defined in C++. CAnimationLayer is already laid out in the same structure as the CAnimationOverlay enum, making the enum unnecessary (plus the enum pollutes the global namespace, eugh).
CAnimationLayer inherits from CAnimationOverlay for backwards compatibility reasons only, but should be removed in the future when CAnimationOverlay gets removed.
Add CTFNavArea methodmap
TFNavAttributeType enum values were present but not being used
Requires cbasenpc/tf/nav.inc to be manually included. It's not automatically included for possible(?) future compatibility with other games and to avoid unnecessarily polluting the global namespace.
Add properties and natives for Segment and CursorData methodmaps
Add Path.GetClosestPosition native
Add optional fraction parameter for ILocomotion.IsPotentiallyTraversable and ILocomotion.IsPotentialGap
Add CEntityFactory.DeriveFromConf native, allowing the use of using any CBaseEntity or derived constructor in memory
Add IsNamed, Destroy, HasData natives to NextBotAction
Add void return type NextBotAction callbacks
Add Activity type for OnAnimationActivityComplete/Interrupted action event callbacks
Expose buried and covering Actions
Add stricter checking for CEntityFactory.DeriveFromFactory
Add standard C++ structure alignment for custom datamaps
Add documentation
Changes:
Update native formatting to be more consistent
Change uses of CBaseEntity.iEnt to the new CBaseEntity.index property
Update use of DHooks to use newer syntax
Remove redundant Update and Reset natives from IIntention
Already defined in the INextBotComponent methodmap and both methods are virtual
Throw error if attempting to return wrong type of Action result in action or event callbacks
Change CBaseEntity.GetFlags to become an alias of GetEntityFlags.
The reason for this change is because the flags in entity_prop_stocks.inc will not always match the engine's. SourceMod will perform conversion between the two sets of flags, so it's better to let SM handle this case than ourselves. See: https://sm.alliedmods.net/new-api/entity_prop_stocks/GetEntityFlags
It's not necessary to change anything on the C++ side; we already have access to the C++ source code and thus the flag sets should change accordingly depending on the games this extension may be compiled for in the future (I hope).
Change Path.GetPosition argument order
This is to accommodate for the seg parameter changed to being optional. Path::GetPosition takes seg as an optional argument and by default is NULL, so the native should be consistent in that aspect. If a plugin used this native, they will have to be recompiled.
Delete Destroy native from PathFollower, ChasePath, and DirectChasePath methodmaps
Redundant; already defined in Path methodmap. Plugins will need to be recompiled if they used the deleted methods.
Allow Path.GetPosition and Path.Draw to take NULL segments
Changed Path_FilterOnlyActors to check for NextBots instead of just NPCs
Removed navmesh include guard for Path_Cost callback
I don't plan to make that plugin compatible with this; the methodmaps conflict with each other so it's not like this include guard would have done anything in the first place anyways.
The purpose of this PR is to refactor the include file structure and to add some natives to make some methodmaps more complete and useful. This also fixes bugs that were present with some natives, and changes some entirely.
The new file structure is as follows:
NextBotAction
NextBotActionFactory
IBody
IIntention
CKnownEntity
ILocomotion
NextBotGroundLocomotion
Segment
CursorData
Path
PathFollower
ChasePath
DirectChasePath
Path_Cost
Path_FilterIgnoreActors
Path_FilterOnlyActors
IVision
TFNavAttributeType
CTFNavArea
CBaseAnimating
CBaseAnimatingOverlay
CAnimationLayer
CAnimationOverlay
(deprecated)CBaseCombatCharacter
CBaseEntity
CEntityFactory
CNavMesh
CNavArea
CTNavArea
TraceFilterActors
INextBotEventResponder
INextBotComponent
INextBot
CExtNPC
CBaseNPC
CNPCs
Fixes:
OnAnimationEvent
typesetTheNavMesh
not being usedContinue
instead ofTryContinue
in Scout'sOnInjured
event callbackILocomotion.ClimbUpToLedge
getting entity from wrong parameterAdditions:
MatrixPosition
stockTEAM_ANY
defineCBaseEntity
KeyValue
and entity IO method aliasesMyNextBotPointer
,GetBaseAnimating
, andMyCombatCharacterPointer
nativesCBaseNPC_GetNextBotOfEntity
be deprecated?CBaseEntity.GetFlags
IsCombatCharacter
nativeentity_prop_stocks.inc
Get
/SetEntProp
native aliasesCAnimationLayer
methodmapCAnimationOverlay
methodmap. This change aims to enforce consistency to the same structure defined in C++.CAnimationLayer
is already laid out in the same structure as theCAnimationOverlay
enum, making the enum unnecessary (plus the enum pollutes the global namespace, eugh).CAnimationLayer
inherits fromCAnimationOverlay
for backwards compatibility reasons only, but should be removed in the future whenCAnimationOverlay
gets removed.CTFNavArea
methodmapTFNavAttributeType
enum values were present but not being usedcbasenpc/tf/nav.inc
to be manually included. It's not automatically included for possible(?) future compatibility with other games and to avoid unnecessarily polluting the global namespace.Segment
andCursorData
methodmapsPath.GetClosestPosition
nativeILocomotion.IsPotentiallyTraversable
andILocomotion.IsPotentialGap
CEntityFactory.DeriveFromConf
native, allowing the use of using anyCBaseEntity
or derived constructor in memoryIsNamed
,Destroy
,HasData
natives toNextBotAction
void
return typeNextBotAction
callbacksActivity
type forOnAnimationActivityComplete
/Interrupted
action event callbacksCEntityFactory.DeriveFromFactory
Changes:
CBaseEntity.iEnt
to the newCBaseEntity.index
propertyUpdate
andReset
natives from IIntentionINextBotComponent
methodmap and both methods are virtualCBaseEntity.GetFlags
to become an alias ofGetEntityFlags
.entity_prop_stocks.inc
will not always match the engine's. SourceMod will perform conversion between the two sets of flags, so it's better to let SM handle this case than ourselves. See: https://sm.alliedmods.net/new-api/entity_prop_stocks/GetEntityFlagsPath.GetPosition
argument orderseg
parameter changed to being optional.Path::GetPosition
takesseg
as an optional argument and by default isNULL
, so the native should be consistent in that aspect. If a plugin used this native, they will have to be recompiled.Destroy
native fromPathFollower
,ChasePath
, andDirectChasePath
methodmapsPath
methodmap. Plugins will need to be recompiled if they used the deleted methods.Path.GetPosition
andPath.Draw
to takeNULL
segmentsPath_FilterOnlyActors
to check for NextBots instead of just NPCsPath_Cost
callback