Skip to content

Commit 25fa4b5

Browse files
committed
fix zombies
1 parent 3a96d6e commit 25fa4b5

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

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

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,13 +1511,11 @@ void CTFBot::Spawn()
15111511
SetBrokenFormation( false );
15121512

15131513
GetVisionInterface()->ForgetAllKnownEntities();
1514-
1515-
#ifdef BDSBASE
1516-
ManageModelOverride();
1517-
#endif
15181514
}
15191515

15201516
#ifdef BDSBASE
1517+
extern ConVar tf_forced_holiday;
1518+
15211519
void CTFBot::ManageModelOverride(void)
15221520
{
15231521
if (TFGameRules() && TFGameRules()->IsMannVsMachineMode())
@@ -1548,8 +1546,17 @@ void CTFBot::ManageModelOverride(void)
15481546
SetBloodColor(BLOOD_COLOR_RED);
15491547
}
15501548

1549+
bool bHalloween = (TFGameRules() ? TFGameRules()->IsHolidayActive(kHoliday_HalloweenOrFullMoon) : TF_IsHolidayActive(kHoliday_HalloweenOrFullMoon));
1550+
1551+
if (!bHalloween)
1552+
{
1553+
Warning("Bot %s is trying to spawn with the Zombie item, but it isn't Halloween/Full Moon. Turning the holiday on.", GetPlayerName());
1554+
1555+
tf_forced_holiday.SetValue(kHoliday_Halloween);
1556+
UTIL_CalculateHolidays();
1557+
}
1558+
15511559
// zombies use the original player models
1552-
m_nSkin = 4;
15531560
const char* name = g_aRawPlayerClassNamesShort[nClassIndex];
15541561
AddItem(CFmtStr("Zombie %s", name));
15551562
}
@@ -1578,8 +1585,6 @@ void CTFBot::HandleCommand_JoinClass(const char* pClassName, bool bAllowSpawn)
15781585
BaseClass::HandleCommand_JoinClass(pClassName, bAllowSpawn);
15791586

15801587
m_InitialLoadoutLoadTimer.Start(RandomFloat(TFBOT_MIN_LOADOUT_WAIT, TFBOT_MAX_LOADOUT_WAIT) + TFBOT_CLASSSWITCH_LOADOUT_DELAY);
1581-
1582-
ManageModelOverride();
15831588
}
15841589
#endif
15851590

@@ -4823,12 +4828,13 @@ void CTFBot::HandleLoadout(void)
48234828
if (TFGameRules() && TFGameRules()->IsMannVsMachineMode())
48244829
return;
48254830

4831+
if (!m_InitialLoadoutLoadTimer.IsElapsed())
4832+
return;
4833+
48264834
bool bLoggedIntoSteam = steamapicontext && steamapicontext->SteamUser() && steamapicontext->SteamUser()->BLoggedOn();
4827-
if (bLoggedIntoSteam && tf_bot_give_items.GetBool() && !(TFGameRules() && TFGameRules()->IsMannVsMachineMode()))
4828-
{
4829-
if (!m_InitialLoadoutLoadTimer.IsElapsed())
4830-
return;
48314835

4836+
if (bLoggedIntoSteam && tf_bot_give_items.GetBool())
4837+
{
48324838
if (vecSavedRandomLoadout.Count() > 0)
48334839
{
48344840
GiveSavedLoadout();
@@ -4838,9 +4844,11 @@ void CTFBot::HandleLoadout(void)
48384844
SelectRandomizedLoadout();
48394845
GiveSavedLoadout();
48404846
}
4841-
4842-
m_InitialLoadoutLoadTimer.Invalidate();
48434847
}
4848+
4849+
ManageModelOverride();
4850+
4851+
m_InitialLoadoutLoadTimer.Invalidate();
48444852
}
48454853

48464854
void CTFBot::ResetLoadout(void)

0 commit comments

Comments
 (0)