Added a way to override climb node lineup linkage via target node keyvalue

This commit is contained in:
Blixibon 2021-05-11 10:10:44 -05:00
parent 8bf258eb75
commit 184be1a794
3 changed files with 22 additions and 1 deletions

View File

@ -289,6 +289,11 @@ public:
void SetHintType( int hintType, bool force = false );
string_t HintActivityName( void ) const { return m_NodeData.iszActivityName; }
int GetTargetNode( void ) const { return m_nTargetNodeID; }
#ifdef MAPBASE
// HACKHACK: This is for when target nodes need to be accessed before being sorted into engine IDs
int GetTargetWCNodeID( void ) const { return m_NodeData.nTargetWCNodeID; }
int GetWCNodeID( void ) const { return m_NodeData.nWCNodeID; }
#endif
bool IsDisabled( void ) const { return (m_NodeData.iDisabled != 0); }
void SetDisabled( bool bDisabled ) { m_NodeData.iDisabled = bDisabled; }
void DisableForSeconds( float flSeconds );
@ -319,7 +324,9 @@ public:
const char* ScriptGetHintActivity() { return STRING( HintActivityName() ); }
#endif
#ifndef MAPBASE
private:
#endif
void Spawn( void );
virtual void Activate();
virtual void UpdateOnRemove( void );

View File

@ -227,7 +227,11 @@ int CNodeEnt::Spawn( const char *pMapData )
// ---------------------------------------------------------------------------------
CAI_Hint *pHint = NULL;
if ( ClassMatches( "info_node_hint" ) || ClassMatches( "info_node_air_hint" ) )
if ( ClassMatches( "info_node_hint" ) || ClassMatches( "info_node_air_hint" )
#ifdef MAPBASE
|| ClassMatches( "info_node_climb" ) // Climb nodes contain hint data in the FGD
#endif
)
{
if ( m_NodeData.nHintType || m_NodeData.strGroup != NULL_STRING || m_NodeData.strEntityName != NULL_STRING )
{

View File

@ -3059,6 +3059,16 @@ int CAI_NetworkBuilder::ComputeConnection( CAI_Node *pSrcNode, CAI_Node *pDestNo
}
else
{
#ifdef MAPBASE
// This is kind of a hack since target node IDs are designed to be used *after* the nodegraph is generated.
// However, for the purposes of forcing a climb connection outside of regular lineup bounds, it works.
if (pSrcNode->GetHint() && pDestNode->GetHint() &&
(pSrcNode->GetHint()->GetTargetWCNodeID() == pDestNode->GetHint()->GetWCId() || pDestNode->GetHint()->GetTargetWCNodeID() == pSrcNode->GetHint()->GetWCId()))
{
DebugConnectMsg( srcId, destId, " Ignoring climbing lineup due to manual target ID linkage\n" );
}
else
#endif
if ( !IsInLineForClimb(srcPos, UTIL_YawToVector( pSrcNode->m_flYaw ), destPos, UTIL_YawToVector( pDestNode->m_flYaw ) ) )
{
Assert( !IsInLineForClimb(destPos, UTIL_YawToVector( pDestNode->m_flYaw ), srcPos, UTIL_YawToVector( pSrcNode->m_flYaw ) ) );