Misc. NPC fixes

This commit is contained in:
Blixibon 2021-10-10 19:51:49 -05:00
parent f63213afc3
commit 3431f21f4d
7 changed files with 34 additions and 12 deletions

View File

@ -6618,15 +6618,7 @@ Activity CAI_BaseNPC::NPC_TranslateActivity( Activity eNewActivity )
{ {
case ACT_RANGE_ATTACK1: eNewActivity = ACT_RANGE_ATTACK1_LOW; break; case ACT_RANGE_ATTACK1: eNewActivity = ACT_RANGE_ATTACK1_LOW; break;
case ACT_RELOAD: eNewActivity = ACT_RELOAD_LOW; break; case ACT_RELOAD: eNewActivity = ACT_RELOAD_LOW; break;
case ACT_IDLE: eNewActivity = ACT_CROUCHIDLE; break; case ACT_IDLE: eNewActivity = ACT_RANGE_AIM_LOW; break; // ACT_CROUCHIDLE is more-or-less deprecated and not friendly to weapon translation
// ====
// HACK : LEIPZIG 06 - The underlying problem is that the AR2 and SMG1 cannot map IDLE_ANGRY to a crouched equivalent automatically
// which causes the character to pop up and down in their idle state of firing while crouched. -- jdw
case ACT_IDLE_ANGRY_SMG1:
case ACT_IDLE_ANGRY_AR2:
eNewActivity = ACT_RANGE_AIM_LOW;
break;
} }
} }

View File

@ -3015,8 +3015,17 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
case TASK_ITEM_PICKUP: case TASK_ITEM_PICKUP:
{ {
#ifdef MAPBASE
if (GetTarget() && fabs( GetTarget()->WorldSpaceCenter().z - GetAbsOrigin().z ) >= 12.0f)
{
SetIdealActivity( ACT_PICKUP_RACK );
}
else
#endif
{
SetIdealActivity( ACT_PICKUP_GROUND ); SetIdealActivity( ACT_PICKUP_GROUND );
} }
}
break; break;
case TASK_WEAPON_PICKUP: case TASK_WEAPON_PICKUP:

View File

@ -388,6 +388,8 @@ private:
void InputSetCycle( inputdata_t &inputdata ); void InputSetCycle( inputdata_t &inputdata );
void InputSetPlaybackRate( inputdata_t &inputdata ); void InputSetPlaybackRate( inputdata_t &inputdata );
public: // From Alien Swarm SDK
#endif #endif
bool CanSkipAnimation( void ); bool CanSkipAnimation( void );

View File

@ -373,7 +373,12 @@ bool CBaseCombatWeapon::WeaponLOSCondition( const Vector &ownerPos, const Vector
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int CBaseCombatWeapon::WeaponRangeAttack1Condition( float flDot, float flDist ) int CBaseCombatWeapon::WeaponRangeAttack1Condition( float flDot, float flDist )
{ {
#ifdef MAPBASE
// HACKHACK: HasPrimaryAmmo() checks the NPC's reserve ammo counts, which should not be evaluated here if we use clips
if ( UsesPrimaryAmmo() && (UsesClipsForAmmo1() ? !m_iClip1 : !HasPrimaryAmmo()) )
#else
if ( UsesPrimaryAmmo() && !HasPrimaryAmmo() ) if ( UsesPrimaryAmmo() && !HasPrimaryAmmo() )
#endif
{ {
return COND_NO_PRIMARY_AMMO; return COND_NO_PRIMARY_AMMO;
} }

View File

@ -689,6 +689,12 @@ bool CNPC_Barnacle::CanPickup( CBaseCombatCharacter *pBCC )
if( FClassnameIs( pBCC, "npc_turret_floor" ) ) if( FClassnameIs( pBCC, "npc_turret_floor" ) )
return false; return false;
#ifdef MAPBASE
// Don't pickup rollermines
if( FClassnameIs( pBCC, "npc_rollermine" ) )
return false;
#endif
// Don't pick up a dead player or NPC // Don't pick up a dead player or NPC
if( !pBCC->IsAlive() ) if( !pBCC->IsAlive() )
return false; return false;

View File

@ -4945,7 +4945,12 @@ int CNPC_MetroPolice::SelectSchedule( void )
// This will cause the cops to run backwards + shoot at the same time // This will cause the cops to run backwards + shoot at the same time
if ( !bHighHealth && !HasBaton() ) if ( !bHighHealth && !HasBaton() )
{ {
#ifdef MAPBASE
// Don't do this with the 357 or any weapons which don't use clips
if ( GetActiveWeapon() && GetActiveWeapon()->UsesClipsForAmmo1() && GetActiveWeapon()->m_iClassname != gm_isz_class_357 && (GetActiveWeapon()->m_iClip1 <= 5) )
#else
if ( GetActiveWeapon() && (GetActiveWeapon()->m_iClip1 <= 5) ) if ( GetActiveWeapon() && (GetActiveWeapon()->m_iClip1 <= 5) )
#endif
{ {
#ifdef METROPOLICE_USES_RESPONSE_SYSTEM #ifdef METROPOLICE_USES_RESPONSE_SYSTEM
SpeakIfAllowed( TLK_COP_LOWAMMO ); SpeakIfAllowed( TLK_COP_LOWAMMO );

View File

@ -582,8 +582,11 @@ bool CNPC_Vortigaunt::InnateWeaponLOSCondition( const Vector &ownerPos, const Ve
UTIL_PredictedPosition( GetEnemy(), flTimeDelta, &vecNewTargetPos ); UTIL_PredictedPosition( GetEnemy(), flTimeDelta, &vecNewTargetPos );
#ifdef MAPBASE #ifdef MAPBASE
// This fix was created by DKY. // There's apparently a null pointer crash here
// His original comment is below. if (!GetEnemy())
return false;
// The fix below and its accompanying comment were created by DKY.
/* /*