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_RELOAD: eNewActivity = ACT_RELOAD_LOW; break;
case ACT_IDLE: eNewActivity = ACT_CROUCHIDLE; break;
// ====
// 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;
case ACT_IDLE: eNewActivity = ACT_RANGE_AIM_LOW; break; // ACT_CROUCHIDLE is more-or-less deprecated and not friendly to weapon translation
}
}

View File

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

View File

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

View File

@ -373,7 +373,12 @@ bool CBaseCombatWeapon::WeaponLOSCondition( const Vector &ownerPos, const Vector
//-----------------------------------------------------------------------------
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() )
#endif
{
return COND_NO_PRIMARY_AMMO;
}

View File

@ -689,6 +689,12 @@ bool CNPC_Barnacle::CanPickup( CBaseCombatCharacter *pBCC )
if( FClassnameIs( pBCC, "npc_turret_floor" ) )
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
if( !pBCC->IsAlive() )
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
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) )
#endif
{
#ifdef METROPOLICE_USES_RESPONSE_SYSTEM
SpeakIfAllowed( TLK_COP_LOWAMMO );

View File

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