//----------------------------------------------------------------------------- // Purpose: Speak a concept if we're able to //----------------------------------------------------------------------------- void CAI_BehaviorAlyxInjured::SpeakIfAllowed( AIConcept_t concept ) { CAI_Expresser *pExpresser = GetOuter()->GetExpresser(); if ( pExpresser == NULL ) return; // Must be able to speak the concept if ( pExpresser->CanSpeakConcept( concept ) ) { pExpresser->Speak( concept ); } }
bool CAI_LeadBehavior::Speak( AIConcept_t concept ) { CAI_Expresser *pExpresser = GetOuter()->GetExpresser(); if ( !pExpresser ) return false; // If the leader is gagged, don't speak any lead speech if ( m_gagleader ) return false; // If we haven't said the start speech, don't nag bool bNag = ( FStrEq(concept,TLK_LEAD_COMINGBACK) || FStrEq(concept, TLK_LEAD_CATCHUP) || FStrEq(concept, TLK_LEAD_RETRIEVE) ); if ( !m_hasspokenstart && bNag ) return false; if ( hl2_episodic.GetBool() ) { // If we're a player ally, only speak the concept if we're allowed to. // This allows the response rules to control it better (i.e. handles respeakdelay) // We ignore nag timers for this, because the response rules will control refire rates. CAI_PlayerAlly *pAlly = dynamic_cast<CAI_PlayerAlly*>(GetOuter()); if ( pAlly ) return pAlly->SpeakIfAllowed( concept, GetConceptModifiers( concept ) ); } // Don't spam Nags if ( bNag ) { if ( m_flSpeakNextNagTime > gpGlobals->curtime ) { DevMsg( GetOuter(), "Leader didn't speak due to Nag timer.\n"); return false; } } if ( pExpresser->Speak( concept, GetConceptModifiers( concept ) ) ) { m_flSpeakNextNagTime = gpGlobals->curtime + LEAD_NAG_TIME; return true; } return false; }