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 );
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 );

View File

@ -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));
}

View File

@ -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;

View File

@ -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);