void CAI_LeadGoal::InputSetSuccess( inputdata_t &inputdata )
{
	CAI_LeadBehavior *pBehavior = GetLeadBehavior();
	if ( !pBehavior )
		return;
		
	// @TODO (toml 02-14-03): Hackly!
	pBehavior->SetCondition( CAI_LeadBehavior::COND_LEAD_SUCCESS);
}
void CAI_LeadGoal_Weapon::InputActivate( inputdata_t &inputdata )
{
	BaseClass::InputActivate( inputdata );

	CAI_LeadBehavior *pBehavior = GetLeadBehavior();
	if ( pBehavior )
	{
		pBehavior->SetWaitForWeapon( m_iszWeaponName );
	}
}
void CAI_LeadGoal::InputDeactivate( inputdata_t &inputdata )
{
	BaseClass::InputDeactivate( inputdata );

	CAI_LeadBehavior *pBehavior = GetLeadBehavior();
	if ( !pBehavior )
		return;
		
	pBehavior->StopLeading();
}
void CAI_LeadGoal::InputActivate( inputdata_t &inputdata )
{
	BaseClass::InputActivate( inputdata );
	
	CAI_LeadBehavior *pBehavior = GetLeadBehavior();
	if ( !pBehavior )
	{
		DevMsg( "Lead goal entity activated for an NPC that doesn't have the lead behavior\n" );
		return;
	}
#ifdef HL2_EPISODIC
 	if ( (m_flLeadDistance*4) < m_flRetrieveDistance )
	{
		Warning("ai_goal_lead '%s': lead distance (%.2f) * 4 is < retrieve distance (%.2f). This will make the NPC act stupid. Either reduce the retrieve distance, or increase the lead distance.\n", GetDebugName(), m_flLeadDistance, m_flRetrieveDistance );
	}
#endif

	if ( m_flRetrieveDistance < (m_flLeadDistance + LEAD_MIN_RETRIEVEDIST_OFFSET) )
	{
#ifdef HL2_EPISODIC
		Warning("ai_goal_lead '%s': retrieve distance (%.2f) < lead distance (%.2f) + %d. Retrieve distance should be at least %d greater than the lead distance, or NPC will ping-pong while retrieving.\n", GetDebugName(), m_flRetrieveDistance, m_flLeadDistance, LEAD_MIN_RETRIEVEDIST_OFFSET, LEAD_MIN_RETRIEVEDIST_OFFSET );
#endif
		m_flRetrieveDistance = m_flLeadDistance + LEAD_MIN_RETRIEVEDIST_OFFSET;
	}

	AI_LeadArgs_t leadArgs = { 
		GetGoalEntityName(), 
		STRING(m_iszWaitPointName), 
		m_spawnflags, 
		m_flWaitDistance, 
		m_flLeadDistance, 
		m_flRetrieveDistance, 
		m_flSuccessDistance,
		m_bRun, 
		m_iRetrievePlayer, 
		m_iRetrieveWaitForSpeak, 
		m_iComingBackWaitForSpeak, 
		m_bStopScenesWhenPlayerLost,
		m_bDontSpeakStart,
		m_bLeadDuringCombat,
		m_bGagLeader,
	};
	
	pBehavior->LeadPlayer( leadArgs, this );
}
Beispiel #5
0
void CAI_LeadGoal::InputActivate(inputdata_t &inputdata)
{
    BaseClass::InputActivate(inputdata);

    CAI_LeadBehavior *pBehavior = GetLeadBehavior();
    if (!pBehavior)
    {
        DevMsg("Lead goal entity activated for an NPC that doesn't have the lead behavior\n");
        return;
    }

    if ( m_flRetrieveDistance < (m_flLeadDistance + LEAD_MIN_RETRIEVEDIST_OFFSET) )
    {
        m_flRetrieveDistance = m_flLeadDistance + LEAD_MIN_RETRIEVEDIST_OFFSET;
    }

    AI_LeadArgs_t leadArgs = {
        GetGoalEntityName(),
        STRING(m_iszWaitPointName),
        m_spawnflags, 
        m_flWaitDistance, 
        m_flLeadDistance,
        m_flRetrieveDistance,
        m_flSuccessDistance,
        m_bRun,
        m_iRetrievePlayer,
        m_iRetrieveWaitForSpeak,
        m_iComingBackWaitForSpeak,
        m_bStopScenesWhenPlayerLost,
        m_bDontSpeakStart,
        m_bLeadDuringCombat,
        m_bGagLeader,
    };

    pBehavior->LeadPlayer(leadArgs, this);
}