Merge pull request #112 from FreeSlave/opfor-update

Opfor update
This commit is contained in:
Andrey Akhmichin 2019-11-12 11:19:36 +05:00 committed by GitHub
commit d12c19f6cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 12 deletions

View File

@ -172,6 +172,7 @@ public:
void ClearSchedule( void ); void ClearSchedule( void );
BOOL FScheduleDone( void ); BOOL FScheduleDone( void );
void ChangeSchedule( Schedule_t *pNewSchedule ); void ChangeSchedule( Schedule_t *pNewSchedule );
virtual void OnChangeSchedule( Schedule_t *pNewSchedule ) {}
void NextScheduledTask( void ); void NextScheduledTask( void );
Schedule_t *ScheduleInList( const char *pName, Schedule_t **pList, int listCount ); Schedule_t *ScheduleInList( const char *pName, Schedule_t **pList, int listCount );

View File

@ -250,6 +250,7 @@ public:
void StartTask( Task_t *pTask ); void StartTask( Task_t *pTask );
Schedule_t *GetSchedule ( void ); Schedule_t *GetSchedule ( void );
Schedule_t *GetScheduleOfType(int Type); Schedule_t *GetScheduleOfType(int Type);
void OnChangeSchedule( Schedule_t *pNewSchedule );
void StopFollowing( BOOL clearSchedule ); void StopFollowing( BOOL clearSchedule );
void SetAnswerQuestion(CTalkMonster *pSpeaker); void SetAnswerQuestion(CTalkMonster *pSpeaker);
@ -2284,9 +2285,7 @@ int CHFGrunt :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
if( m_hEnemy == 0 ) if( m_hEnemy == 0 )
{ {
// If the player was facing directly at me, or I'm already suspicious, get mad // 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! // Alright, now I'm pissed!
PlaySentence( "FG_MAD", 4, VOL_NORM, ATTN_NORM ); PlaySentence( "FG_MAD", 4, VOL_NORM, ATTN_NORM );
@ -2294,7 +2293,6 @@ int CHFGrunt :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
Remember( bits_MEMORY_PROVOKED ); Remember( bits_MEMORY_PROVOKED );
StopFollowing( TRUE ); StopFollowing( TRUE );
} }
}
else else
{ {
if ( gpGlobals->time - m_flLastHitByPlayer >= 4.0 ) if ( gpGlobals->time - m_flLastHitByPlayer >= 4.0 )
@ -3623,12 +3621,16 @@ void CMedic::RunTask(Task_t *pTask)
} }
} }
Schedule_t *CMedic::GetSchedule() void CMedic::OnChangeSchedule( Schedule_t *pNewSchedule )
{ {
if (m_fHealing) { if (m_fHealing) {
StopHealing(); StopHealing();
} }
CHFGrunt::OnChangeSchedule( pNewSchedule );
}
Schedule_t *CMedic::GetSchedule()
{
Schedule_t* prioritizedSchedule = PrioritizedSchedule(); Schedule_t* prioritizedSchedule = PrioritizedSchedule();
if (prioritizedSchedule) if (prioritizedSchedule)
return prioritizedSchedule; return prioritizedSchedule;
@ -3866,7 +3868,6 @@ void CMedic::StartFollowingHealTarget(CBaseEntity *pTarget)
m_hTargetEnt = pTarget; m_hTargetEnt = pTarget;
ClearConditions( bits_COND_CLIENT_PUSH ); ClearConditions( bits_COND_CLIENT_PUSH );
ClearSchedule(); ClearSchedule();
ChangeSchedule(GetScheduleOfType(SCHED_MEDIC_HEAL));
ALERT(at_aiconsole, "Medic started to follow injured %s\n", STRING(pTarget->pev->classname)); ALERT(at_aiconsole, "Medic started to follow injured %s\n", STRING(pTarget->pev->classname));
} }

View File

@ -79,6 +79,8 @@ void CBaseMonster::ChangeSchedule( Schedule_t *pNewSchedule )
{ {
ASSERT( pNewSchedule != NULL ); ASSERT( pNewSchedule != NULL );
OnChangeSchedule( pNewSchedule );
m_pSchedule = pNewSchedule; m_pSchedule = pNewSchedule;
m_iScheduleIndex = 0; m_iScheduleIndex = 0;
m_iTaskStatus = TASKSTATUS_NEW; m_iTaskStatus = TASKSTATUS_NEW;

View File

@ -611,7 +611,7 @@ void CTalkMonster::Killed( entvars_t *pevAttacker, int iGib )
// Don't finish that sentence // Don't finish that sentence
StopTalking(); StopTalking();
SetUse( NULL ); SetUse( NULL );
CBaseMonster::Killed( pevAttacker, iGib ); CSquadMonster::Killed( pevAttacker, iGib );
} }
CBaseEntity *CTalkMonster::EnumFriends( CBaseEntity *pPrevious, int listNumber, BOOL bTrace ) CBaseEntity *CTalkMonster::EnumFriends( CBaseEntity *pPrevious, int listNumber, BOOL bTrace )
@ -1301,7 +1301,7 @@ void CTalkMonster::TrySmellTalk( void )
void CTalkMonster::StartMonster() void CTalkMonster::StartMonster()
{ {
CBaseMonster::StartMonster(); CSquadMonster::StartMonster();
if (m_fStartSuspicious) { if (m_fStartSuspicious) {
ALERT(at_console, "Talk Monster Pre-Provoked\n"); ALERT(at_console, "Talk Monster Pre-Provoked\n");
Remember(bits_MEMORY_PROVOKED); Remember(bits_MEMORY_PROVOKED);