Browse Source

Fix ally grunt schedule priority

opforfixed
Roman Chistokhodov 5 years ago
parent
commit
6e7bf80d08
  1. 53
      dlls/gearbox/fgrunt.cpp

53
dlls/gearbox/fgrunt.cpp

@ -163,6 +163,7 @@ public:
// Override these to set behavior // Override these to set behavior
Schedule_t *GetScheduleOfType ( int Type ); Schedule_t *GetScheduleOfType ( int Type );
Schedule_t *GetSchedule ( void ); Schedule_t *GetSchedule ( void );
Schedule_t *PrioritizedSchedule();
MONSTERSTATE GetIdealState ( void ); MONSTERSTATE GetIdealState ( void );
void AlertSound( void ); void AlertSound( void );
@ -2619,8 +2620,27 @@ void CHFGrunt :: SetActivity ( Activity NewActivity )
// monster's member function to get a pointer to a schedule // monster's member function to get a pointer to a schedule
// of the proper type. // of the proper type.
//========================================================= //=========================================================
Schedule_t *CHFGrunt :: GetSchedule ( void ) Schedule_t* CHFGrunt::PrioritizedSchedule()
{ {
// flying? If PRONE, barnacle has me. IF not, it's assumed I am rapelling.
if ( pev->movetype == MOVETYPE_FLY && m_MonsterState != MONSTERSTATE_PRONE )
{
if (pev->flags & FL_ONGROUND)
{
// just landed
pev->movetype = MOVETYPE_STEP;
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL_LAND );
}
else
{
// repel down a rope,
if ( m_MonsterState == MONSTERSTATE_COMBAT )
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL_ATTACK );
else
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL );
}
}
// grunts place HIGH priority on running away from danger sounds. // grunts place HIGH priority on running away from danger sounds.
if ( HasConditions(bits_COND_HEAR_SOUND) ) if ( HasConditions(bits_COND_HEAR_SOUND) )
{ {
@ -2649,24 +2669,15 @@ Schedule_t *CHFGrunt :: GetSchedule ( void )
} }
} }
} }
// flying? If PRONE, barnacle has me. IF not, it's assumed I am rapelling. return NULL;
if ( pev->movetype == MOVETYPE_FLY && m_MonsterState != MONSTERSTATE_PRONE ) }
{
if (pev->flags & FL_ONGROUND) Schedule_t *CHFGrunt :: GetSchedule ( void )
{ {
// just landed Schedule_t* prioritizedSchedule = PrioritizedSchedule();
pev->movetype = MOVETYPE_STEP; if (prioritizedSchedule)
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL_LAND ); return prioritizedSchedule;
}
else
{
// repel down a rope,
if ( m_MonsterState == MONSTERSTATE_COMBAT )
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL_ATTACK );
else
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL );
}
}
if ( HasConditions( bits_COND_ENEMY_DEAD ) && FOkToSpeak() ) if ( HasConditions( bits_COND_ENEMY_DEAD ) && FOkToSpeak() )
{ {
PlaySentence( "FG_KILL", 4, VOL_NORM, ATTN_NORM ); PlaySentence( "FG_KILL", 4, VOL_NORM, ATTN_NORM );
@ -3617,6 +3628,10 @@ Schedule_t *CMedic::GetSchedule()
if (m_fHealing) { if (m_fHealing) {
StopHealing(); StopHealing();
} }
Schedule_t* prioritizedSchedule = PrioritizedSchedule();
if (prioritizedSchedule)
return prioritizedSchedule;
if ( FBitSet( pev->weapons, MEDIC_EAGLE|MEDIC_HANDGUN ) && if ( FBitSet( pev->weapons, MEDIC_EAGLE|MEDIC_HANDGUN ) &&
(GetBodygroup(MEDIC_GUN_GROUP) == MEDIC_GUN_NEEDLE || GetBodygroup(MEDIC_GUN_GROUP) == MEDIC_GUN_NONE)) { (GetBodygroup(MEDIC_GUN_GROUP) == MEDIC_GUN_NEEDLE || GetBodygroup(MEDIC_GUN_GROUP) == MEDIC_GUN_NONE)) {
return slMedicDrawGun; return slMedicDrawGun;

Loading…
Cancel
Save