Skip to content

Commit 3a96d6e

Browse files
committed
refactor how models are handled.
1 parent af46b9c commit 3a96d6e

File tree

3 files changed

+39
-66
lines changed

3 files changed

+39
-66
lines changed

game/quiver/info_changelog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Quiver Private Alpha 1.1.0 (WIP):
4343
- Set tf_mm_next_map_vote_time from 30s to 15s (From the Summer 2025 update).
4444
- Updated the item schema to support Summer 2025 items.
4545
- Added Goldsource-styled viewmodel bobbing.
46-
- Added the ConVar tf_bot_force_robot_models that makes TFBots look like MVM bots.
46+
- Added the ConVar tf_bot_models_override that makes TFBots look like MVM bots (when set to 1) or zombies (when set to 2).
4747
- Fixed ragdolls sometimes spawning in random places.
4848
- Changed the default Grenade Launcher ammo count from 4 to 6.
4949
- The Axtinguisher now fully crits against burning targets, at the expense of 33% less damage against non-burning players.

src/game/server/tf/bot/tf_bot.cpp

Lines changed: 37 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,44 +1513,57 @@ void CTFBot::Spawn()
15131513
GetVisionInterface()->ForgetAllKnownEntities();
15141514

15151515
#ifdef BDSBASE
1516-
if (TFGameRules() && !TFGameRules()->IsMannVsMachineMode())
1517-
{
1518-
if ((tf_bot_difficulty.GetInt() == CTFBot::UNDEFINED || tf_bot_difficulty.GetInt() > CTFBot::EXPERT) && m_difficulty == CTFBot::UNDEFINED)
1519-
{
1520-
int m_nRandomSeed = RandomInt(0, 9999);
1521-
CUniformRandomStream randomize;
1522-
randomize.SetSeed(m_nRandomSeed);
1516+
ManageModelOverride();
1517+
#endif
1518+
}
15231519

1524-
SetDifficulty((CTFBot::DifficultyType)randomize.RandomInt(CTFBot::EASY, CTFBot::EXPERT));
1525-
}
1520+
#ifdef BDSBASE
1521+
void CTFBot::ManageModelOverride(void)
1522+
{
1523+
if (TFGameRules() && TFGameRules()->IsMannVsMachineMode())
1524+
return;
15261525

1527-
DevMsg("%s chooses skill %s\n", GetPlayerName(), DifficultyLevelToString(m_difficulty));
1526+
int nClassIndex = (GetPlayerClass() ? GetPlayerClass()->GetClassIndex() : TF_CLASS_UNDEFINED);
15281527

1529-
if (IsServerUsingTheFunnyMVMCvar())
1528+
if (IsServerUsingTheFunnyMVMCvar())
1529+
{
1530+
// use the nifty new robot model
1531+
if (nClassIndex >= TF_CLASS_SCOUT && nClassIndex <= TF_CLASS_ENGINEER)
15301532
{
1531-
// use the nifty new robot model
1532-
int nClassIndex = (GetPlayerClass() ? GetPlayerClass()->GetClassIndex() : TF_CLASS_UNDEFINED);
1533-
if (nClassIndex >= TF_CLASS_SCOUT && nClassIndex <= TF_CLASS_ENGINEER)
1533+
if (g_pFullFileSystem->FileExists(g_szBotModels[nClassIndex]))
15341534
{
1535-
if (g_pFullFileSystem->FileExists(g_szBotModels[nClassIndex]))
1536-
{
1537-
GetPlayerClass()->SetCustomModel(g_szBotModels[nClassIndex], USE_CLASS_ANIMATIONS);
1538-
UpdateModel();
1539-
SetBloodColor(DONT_BLEED);
1540-
}
1535+
GetPlayerClass()->SetCustomModel(g_szBotModels[nClassIndex], USE_CLASS_ANIMATIONS);
1536+
UpdateModel();
1537+
SetBloodColor(DONT_BLEED);
15411538
}
15421539
}
1543-
else
1540+
}
1541+
else if (DoesServerWantBrainz())
1542+
{
1543+
//set to old model if needed
1544+
if (GetPlayerClass()->HasCustomModel())
1545+
{
1546+
GetPlayerClass()->SetCustomModel(NULL);
1547+
UpdateModel();
1548+
SetBloodColor(BLOOD_COLOR_RED);
1549+
}
1550+
1551+
// zombies use the original player models
1552+
m_nSkin = 4;
1553+
const char* name = g_aRawPlayerClassNamesShort[nClassIndex];
1554+
AddItem(CFmtStr("Zombie %s", name));
1555+
}
1556+
else
1557+
{
1558+
if (GetPlayerClass()->HasCustomModel())
15441559
{
15451560
GetPlayerClass()->SetCustomModel(NULL);
15461561
UpdateModel();
15471562
SetBloodColor(BLOOD_COLOR_RED);
15481563
}
15491564
}
1550-
#endif
15511565
}
15521566

1553-
#ifdef BDSBASE
15541567
void CTFBot::Regenerate(bool bRefillHealthAndAmmo)
15551568
{
15561569
BaseClass::Regenerate(bRefillHealthAndAmmo);
@@ -1566,48 +1579,7 @@ void CTFBot::HandleCommand_JoinClass(const char* pClassName, bool bAllowSpawn)
15661579

15671580
m_InitialLoadoutLoadTimer.Start(RandomFloat(TFBOT_MIN_LOADOUT_WAIT, TFBOT_MAX_LOADOUT_WAIT) + TFBOT_CLASSSWITCH_LOADOUT_DELAY);
15681581

1569-
if (TFGameRules() && !TFGameRules()->IsMannVsMachineMode())
1570-
{
1571-
int nClassIndex = (GetPlayerClass() ? GetPlayerClass()->GetClassIndex() : TF_CLASS_UNDEFINED);
1572-
1573-
if (IsServerUsingTheFunnyMVMCvar())
1574-
{
1575-
// use the nifty new robot model
1576-
if (nClassIndex >= TF_CLASS_SCOUT && nClassIndex <= TF_CLASS_ENGINEER)
1577-
{
1578-
if (g_pFullFileSystem->FileExists(g_szBotModels[nClassIndex]))
1579-
{
1580-
GetPlayerClass()->SetCustomModel(g_szBotModels[nClassIndex], USE_CLASS_ANIMATIONS);
1581-
UpdateModel();
1582-
SetBloodColor(DONT_BLEED);
1583-
}
1584-
}
1585-
}
1586-
else if (DoesServerWantBrainz())
1587-
{
1588-
//set to old model if needed
1589-
if (GetPlayerClass()->HasCustomModel())
1590-
{
1591-
GetPlayerClass()->SetCustomModel(NULL);
1592-
UpdateModel();
1593-
SetBloodColor(BLOOD_COLOR_RED);
1594-
}
1595-
1596-
// zombies use the original player models
1597-
m_nSkin = 4;
1598-
const char* name = g_aRawPlayerClassNamesShort[nClassIndex];
1599-
AddItem(CFmtStr("Zombie %s", name));
1600-
}
1601-
else
1602-
{
1603-
if (GetPlayerClass()->HasCustomModel())
1604-
{
1605-
GetPlayerClass()->SetCustomModel(NULL);
1606-
UpdateModel();
1607-
SetBloodColor(BLOOD_COLOR_RED);
1608-
}
1609-
}
1610-
}
1582+
ManageModelOverride();
16111583
}
16121584
#endif
16131585

src/game/server/tf/bot/tf_bot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ class CTFBot: public NextBotPlayer< CTFPlayer >, public CGameEventListener
366366
void ScriptHandleLoadout(void) { HandleLoadout(); }
367367
void Regenerate(bool bRefillHealthAndAmmo) OVERRIDE;
368368
void HandleCommand_JoinClass(const char* pClassName, bool bAllowSpawn = true) OVERRIDE;
369+
void ManageModelOverride(void);
369370
#endif
370371
void ScriptGenerateAndWearItem( const char *pszItemName ) { if ( pszItemName ) BotGenerateAndWearItem( this, pszItemName ); }
371372

0 commit comments

Comments
 (0)