Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/game/client/tf/c_tf_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ void C_TFRagdoll::OnDataChanged( DataUpdateType_t type )
CreateTFHeadGib();
EmitSound( "TFPlayer.Decapitated" );

bool bBlood = true;
bool bBlood = !( pPlayer && IsRobotTeam( pPlayer->GetTeamNumber() ) );
if ( TFGameRules() && ( TFGameRules()->UseSillyGibs() ||
( TFGameRules()->IsMannVsMachineMode() && pPlayer && pPlayer->GetTeamNumber() == TF_TEAM_PVE_INVADERS ) ) )
{
Expand Down Expand Up @@ -5800,7 +5800,7 @@ bool C_TFPlayer::CanLightCigarette( void )
}

// don't light for MvM Spy robots
if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS )
if ( IsRobotTeam( GetTeamNumber() ) || ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS ) )
return false;

// Don't light if we are invis.
Expand Down Expand Up @@ -10568,7 +10568,7 @@ void C_TFPlayer::UpdateKillStreakEffects( int iCount, bool bKillScored /* = fals

void C_TFPlayer::UpdateMVMEyeGlowEffect( bool bVisible )
{
if ( !TFGameRules() || !TFGameRules()->IsMannVsMachineMode() || GetTeamNumber() != TF_TEAM_PVE_INVADERS )
if ( !IsRobotTeam( GetTeamNumber() ) || !TFGameRules() || !TFGameRules()->IsMannVsMachineMode() || GetTeamNumber() != TF_TEAM_PVE_INVADERS )
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/tf/tf_fx_impacts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void ImpactCallback( const CEffectData &data )
bool bPlaySound = true;
bool bIsRobotImpact = false;

if ( bIsMVM && pPlayer && nApparentTeam == TF_TEAM_PVE_INVADERS )
if ( ( pPlayer && IsRobotTeam( nApparentTeam ) ) || ( bIsMVM && pPlayer && nApparentTeam == TF_TEAM_PVE_INVADERS ) )
{
bPlaySound = true;
bIsRobotImpact = true;
Expand Down
2 changes: 1 addition & 1 deletion src/game/server/tf/bot/behavior/spy/tf_bot_spy_hide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ActionResult< CTFBot > CTFBotSpyHide::Update( CTFBot *me, float interval )
if ( m_talkTimer.IsElapsed() )
{
m_talkTimer.Start( RandomFloat( 5.0f, 10.0f ) );
if ( TFGameRules()->IsMannVsMachineMode() && me->GetTeamNumber() == TF_TEAM_PVE_INVADERS )
if ( IsRobotTeam( me->GetTeamNumber() ) || ( TFGameRules()->IsMannVsMachineMode() && me->GetTeamNumber() == TF_TEAM_PVE_INVADERS ) )
{
me->EmitSound( "Spy.MVM_TeaseVictim" );
}
Expand Down
37 changes: 31 additions & 6 deletions src/game/server/tf/tf_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ void CTFPlayer::SetGrapplingHookTarget( CBaseEntity *pTarget, bool bShouldBleed
//-----------------------------------------------------------------------------
bool CTFPlayer::CanBeForcedToLaugh( void )
{
if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && IsBot() && ( GetTeamNumber() == TF_TEAM_PVE_INVADERS ) )
if ( IsRobotTeam( GetTeamNumber() ) || ( TFGameRules() && ( TFGameRules()->IsMannVsMachineMode() && IsBot() && ( GetTeamNumber() == TF_TEAM_PVE_INVADERS ) ) ) )
return false;

return true;
Expand Down Expand Up @@ -10834,7 +10834,7 @@ int CTFPlayer::OnTakeDamage_Alive( const CTakeDamageInfo &info )
vDamagePos = WorldSpaceCenter();
}

if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS )
if ( IsRobotTeam( GetTeamNumber() ) || ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS ) )
{
if ( ( IsMiniBoss() && static_cast< float >( GetHealth() ) / GetMaxHealth() > 0.3f ) || realDamage < 50 )
{
Expand Down Expand Up @@ -12420,7 +12420,7 @@ void CTFPlayer::Event_Killed( const CTakeDamageInfo &info )
SetGibbedOnLastDeath( bGib );

bool bIsMvMRobot = TFGameRules()->IsMannVsMachineMode() && IsBot();
if ( bGib && !bIsMvMRobot && IsPlayerClass( TF_CLASS_SCOUT ) && RandomInt( 1, 100 ) <= SCOUT_ADD_BIRD_ON_GIB_CHANCE )
if ( bGib && !bIsMvMRobot && !IsRobotTeam( GetTeamNumber() ) && IsPlayerClass( TF_CLASS_SCOUT ) && RandomInt( 1, 100 ) <= SCOUT_ADD_BIRD_ON_GIB_CHANCE )
{
Vector vecPos = WorldSpaceCenter();
SpawnClientsideFlyingBird( vecPos );
Expand Down Expand Up @@ -14721,6 +14721,22 @@ void CTFPlayer::ForceRespawn( void )
}

m_bSwitchedClass = false;

if ( IsRobotTeam( GetTeamNumber() ) )
{
const int nClassIndex = ( GetPlayerClass() ? GetPlayerClass()->GetClassIndex() : TF_CLASS_UNDEFINED );
if ( nClassIndex >= TF_CLASS_SCOUT && nClassIndex <= TF_CLASS_ENGINEER && g_pFullFileSystem->FileExists( g_szBotModels[ nClassIndex ] ) )
SetCustomModelWithClassAnimations( g_szBotModels[nClassIndex] );

SetBloodColor( DONT_BLEED );
}
else
{
if ( GetPlayerClass()->HasCustomModel() )
SetCustomModelWithClassAnimations( NULL );

SetBloodColor( BLOOD_COLOR_RED );
}
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -15156,7 +15172,16 @@ void CTFPlayer::PainSound( const CTakeDamageInfo &info )
TFPlayerClassData_t *pData = GetPlayerClass()->GetData();
if ( pData )
{
EmitSound( pData->GetDeathSound( DEATH_SOUND_GENERIC ) );
int deathSound = DEATH_SOUND_GENERIC;
if ( IsRobotTeam( GetTeamNumber() ) || ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS ) )
{
deathSound = DEATH_SOUND_GENERIC_MVM;
if ( IsMiniBoss() )
{
deathSound = DEATH_SOUND_GENERIC_GIANT_MVM;
}
}
EmitSound( pData->GetDeathSound( deathSound ) );
}
}
return;
Expand Down Expand Up @@ -15258,7 +15283,7 @@ void CTFPlayer::DeathSound( const CTakeDamageInfo &info )

int nDeathSoundOffset = DEATH_SOUND_FIRST;

if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS )
if ( IsRobotTeam( GetTeamNumber() ) || ( TFGameRules() && ( TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS ) ) )
{
nDeathSoundOffset = IsMiniBoss() ? DEATH_SOUND_GIANT_MVM_FIRST : DEATH_SOUND_MVM_FIRST;
}
Expand Down Expand Up @@ -15317,7 +15342,7 @@ void CTFPlayer::DeathSound( const CTakeDamageInfo &info )
//-----------------------------------------------------------------------------
const char* CTFPlayer::GetSceneSoundToken( void )
{
if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS )
if ( IsRobotTeam( GetTeamNumber() ) || ( TFGameRules() && ( TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS ) ) )
{
if ( IsMiniBoss() )
{
Expand Down
22 changes: 21 additions & 1 deletion src/game/shared/tf/tf_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,8 @@ ConVar tf_mvm_respec_credit_goal( "tf_mvm_respec_credit_goal", "2000", FCVAR_CHE
ConVar tf_mvm_buybacks_method( "tf_mvm_buybacks_method", "0", FCVAR_REPLICATED | FCVAR_HIDDEN, "When set to 0, use the traditional, currency-based system. When set to 1, use finite, charge-based system.", true, 0.0, true, 1.0 );
ConVar tf_mvm_buybacks_per_wave( "tf_mvm_buybacks_per_wave", "3", FCVAR_REPLICATED | FCVAR_HIDDEN, "The fixed number of buybacks players can use per-wave." );

ConVar tf_robot_team( "tf_robot_team", "1", FCVAR_GAMEDLL, "Whether to turn a given team into robots outside of Man vs Machine." );


#ifdef GAME_DLL
enum { kMVM_CurrencyPackMinSize = 1, };
Expand Down Expand Up @@ -1023,6 +1025,24 @@ bool IsCustomGameMode()
}
#endif

bool IsRobotTeam( int team )
{
const int setting = tf_robot_team.GetInt();

if ( setting == 1 )
{
return true;
}
else if ( setting == 0 )
{
return false;
}
else
{
return team == setting;
}
}

// Fetch holiday setting taking into account convars, etc, but NOT
// taking into consideration the current game rules, map, etc.
//
Expand Down Expand Up @@ -3550,7 +3570,7 @@ void CTFGameRules::Precache( void )
CMerasmus::PrecacheMerasmus();
}

if ( MapHasPrefix( STRING( gpGlobals->mapname ), "mvm_" ) )
if ( MapHasPrefix( STRING( gpGlobals->mapname ), "mvm_" ) || tf_robot_team.GetInt() != 0 )
{
CTFPlayer::PrecacheMvM();
}
Expand Down
4 changes: 4 additions & 0 deletions src/game/shared/tf/tf_gamerules.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ class CMannVsMachineUpgrades;
extern ConVar tf_mvm_defenders_team_size;
extern ConVar tf_mvm_max_invaders;

extern ConVar tf_robot_team;

extern bool IsRobotTeam( int );

const int kLadder_TeamSize_6v6 = 6;
const int kLadder_TeamSize_9v9 = 9;
const int kLadder_TeamSize_12v12 = 12;
Expand Down
2 changes: 1 addition & 1 deletion src/game/shared/tf/tf_player_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11979,7 +11979,7 @@ void CTFPlayer::SetStepSoundTime( stepsoundtimes_t iStepSoundTime, bool bWalking
const char *CTFPlayer::GetOverrideStepSound( const char *pszBaseStepSoundName )
{

if( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS && !IsMiniBoss() && !m_Shared.InCond( TF_COND_DISGUISED ) )
if( IsRobotTeam( GetTeamNumber() ) || ( TFGameRules() && ( TFGameRules()->IsMannVsMachineMode() && GetTeamNumber() == TF_TEAM_PVE_INVADERS && !IsMiniBoss() && !m_Shared.InCond( TF_COND_DISGUISED ) ) ) )
{
return "MVM.BotStep";
}
Expand Down
6 changes: 3 additions & 3 deletions src/game/shared/tf/tf_weaponbase_melee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void CTFWeaponBaseMelee::Precache()
{
BaseClass::Precache();

if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() )
if ( tf_robot_team.GetInt() != 0 && ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() ) )
{
char szMeleeSoundStr[128] = "MVM_";
const char *shootsound = GetShootSound( MELEE_HIT );
Expand Down Expand Up @@ -570,9 +570,9 @@ bool CTFWeaponBaseMelee::OnSwingHit( trace_t &trace )

bool bPlayMvMHitOnly = false;
// handle hitting a robot
if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() )
if ( tf_robot_team.GetInt() != 0 || ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() ) )
{
if ( pTargetPlayer && pTargetPlayer->GetTeamNumber() == TF_TEAM_PVE_INVADERS && !pTargetPlayer->IsPlayer() )
if ( pTargetPlayer && ( IsRobotTeam( pTargetPlayer->GetTeamNumber() ) || ( pTargetPlayer->GetTeamNumber() == TF_TEAM_PVE_INVADERS && !pTargetPlayer->IsPlayer() ) ) )
{
bPlayMvMHitOnly = true;

Expand Down