diff --git a/dlls/basemonster.h b/dlls/basemonster.h index d1cf041b..f9f49134 100644 --- a/dlls/basemonster.h +++ b/dlls/basemonster.h @@ -172,6 +172,7 @@ public: void ClearSchedule( void ); BOOL FScheduleDone( void ); void ChangeSchedule( Schedule_t *pNewSchedule ); + virtual void OnChangeSchedule( Schedule_t *pNewSchedule ) {} void NextScheduledTask( void ); Schedule_t *ScheduleInList( const char *pName, Schedule_t **pList, int listCount ); diff --git a/dlls/gearbox/fgrunt.cpp b/dlls/gearbox/fgrunt.cpp index 07ca8988..7b7053bf 100644 --- a/dlls/gearbox/fgrunt.cpp +++ b/dlls/gearbox/fgrunt.cpp @@ -250,6 +250,7 @@ public: void StartTask( Task_t *pTask ); Schedule_t *GetSchedule ( void ); Schedule_t *GetScheduleOfType(int Type); + void OnChangeSchedule( Schedule_t *pNewSchedule ); void StopFollowing( BOOL clearSchedule ); void SetAnswerQuestion(CTalkMonster *pSpeaker); @@ -2284,16 +2285,13 @@ int CHFGrunt :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo if( m_hEnemy == 0 ) { // If the player was facing directly at me, or I'm already suspicious, get mad - if( ( m_afMemory & bits_MEMORY_SUSPICIOUS ) || IsFacing( pevAttacker, pev->origin ) ) + if( (( m_afMemory & bits_MEMORY_SUSPICIOUS ) || IsFacing( pevAttacker, pev->origin )) && gpGlobals->time - m_flLastHitByPlayer < 4.0 && m_iPlayerHits >= 3 ) { - if (gpGlobals->time - m_flLastHitByPlayer < 4.0 && m_iPlayerHits >= 3) - { - // Alright, now I'm pissed! - PlaySentence( "FG_MAD", 4, VOL_NORM, ATTN_NORM ); + // Alright, now I'm pissed! + PlaySentence( "FG_MAD", 4, VOL_NORM, ATTN_NORM ); - Remember( bits_MEMORY_PROVOKED ); - StopFollowing( TRUE ); - } + Remember( bits_MEMORY_PROVOKED ); + StopFollowing( TRUE ); } else { @@ -3623,12 +3621,16 @@ void CMedic::RunTask(Task_t *pTask) } } -Schedule_t *CMedic::GetSchedule() +void CMedic::OnChangeSchedule( Schedule_t *pNewSchedule ) { if (m_fHealing) { StopHealing(); } + CHFGrunt::OnChangeSchedule( pNewSchedule ); +} +Schedule_t *CMedic::GetSchedule() +{ Schedule_t* prioritizedSchedule = PrioritizedSchedule(); if (prioritizedSchedule) return prioritizedSchedule; @@ -3866,7 +3868,6 @@ void CMedic::StartFollowingHealTarget(CBaseEntity *pTarget) m_hTargetEnt = pTarget; ClearConditions( bits_COND_CLIENT_PUSH ); ClearSchedule(); - ChangeSchedule(GetScheduleOfType(SCHED_MEDIC_HEAL)); ALERT(at_aiconsole, "Medic started to follow injured %s\n", STRING(pTarget->pev->classname)); } diff --git a/dlls/schedule.cpp b/dlls/schedule.cpp index 4a5cefca..85f25ade 100644 --- a/dlls/schedule.cpp +++ b/dlls/schedule.cpp @@ -79,6 +79,8 @@ void CBaseMonster::ChangeSchedule( Schedule_t *pNewSchedule ) { ASSERT( pNewSchedule != NULL ); + OnChangeSchedule( pNewSchedule ); + m_pSchedule = pNewSchedule; m_iScheduleIndex = 0; m_iTaskStatus = TASKSTATUS_NEW; diff --git a/dlls/talkmonster.cpp b/dlls/talkmonster.cpp index 6dfc51d4..c9e666b2 100644 --- a/dlls/talkmonster.cpp +++ b/dlls/talkmonster.cpp @@ -611,7 +611,7 @@ void CTalkMonster::Killed( entvars_t *pevAttacker, int iGib ) // Don't finish that sentence StopTalking(); SetUse( NULL ); - CBaseMonster::Killed( pevAttacker, iGib ); + CSquadMonster::Killed( pevAttacker, iGib ); } CBaseEntity *CTalkMonster::EnumFriends( CBaseEntity *pPrevious, int listNumber, BOOL bTrace ) @@ -1301,7 +1301,7 @@ void CTalkMonster::TrySmellTalk( void ) void CTalkMonster::StartMonster() { - CBaseMonster::StartMonster(); + CSquadMonster::StartMonster(); if (m_fStartSuspicious) { ALERT(at_console, "Talk Monster Pre-Provoked\n"); Remember(bits_MEMORY_PROVOKED);