4646
4747void ZR_Infect (CCSPlayerController* pAttackerController, CCSPlayerController* pVictimController, bool bBroadcast);
4848void ZR_Cure (CCSPlayerController* pTargetController);
49- void ZR_EndRoundAndAddTeamScore (int iTeamNum);
49+ void ZR_EndRound (int iTeamNum);
50+ void ZR_FinishRound (int iTeamNum);
5051void SetupCTeams ();
5152bool ZR_IsTeamAlive (int iTeamNum);
5253
@@ -1481,17 +1482,54 @@ AcquireResult ZR_Detour_CCSPlayer_ItemServices_CanAcquire(CCSPlayer_ItemServices
14811482 return AcquireResult::Allowed;
14821483}
14831484
1484- void ZR_Detour_CEntityIdentity_AcceptInput (CEntityIdentity* pThis, CUtlSymbolLarge* pInputName, CEntityInstance* pActivator, CEntityInstance* pCaller, variant_t * value, int nOutputID)
1485+ bool ZR_Detour_CEntityIdentity_AcceptInput (CEntityIdentity* pThis, CUtlSymbolLarge* pInputName, CEntityInstance* pActivator, CEntityInstance* pCaller, variant_t * value, int nOutputID)
14851486{
1487+ const char * inputName = pInputName->String ();
1488+
1489+ if (!V_strcasecmp (pThis->GetClassname (), " info_map_parameters" ) && !V_strcasecmp (inputName, " FireWinCondition" ))
1490+ {
1491+ switch (value->Get <int >())
1492+ {
1493+ case CSRoundEndReason::TargetBombed:
1494+ case CSRoundEndReason::VIPKilled:
1495+ case CSRoundEndReason::TerroristsEscaped:
1496+ case CSRoundEndReason::TerroristWin:
1497+ case CSRoundEndReason::HostagesNotRescued:
1498+ case CSRoundEndReason::VIPNotEscaped:
1499+ case CSRoundEndReason::CTSurrender:
1500+ case CSRoundEndReason::TerroristsPlanted:
1501+ ZR_FinishRound (CS_TEAM_T);
1502+ return true ;
1503+ case CSRoundEndReason::VIPEscaped:
1504+ case CSRoundEndReason::CTStoppedEscape:
1505+ case CSRoundEndReason::TerroristsStopped:
1506+ case CSRoundEndReason::BombDefused:
1507+ case CSRoundEndReason::CTWin:
1508+ case CSRoundEndReason::HostagesRescued:
1509+ case CSRoundEndReason::TargetSaved:
1510+ case CSRoundEndReason::TerroristsNotEscaped:
1511+ case CSRoundEndReason::TerroristsSurrender:
1512+ case CSRoundEndReason::CTsReachedHostage:
1513+ ZR_FinishRound (CS_TEAM_CT);
1514+ return true ;
1515+ // This would allow maps to mess with timeleft, so we're actually just going to block it entirely
1516+ case CSRoundEndReason::GameStart:
1517+ return false ;
1518+ case CSRoundEndReason::Draw:
1519+ default :
1520+ ZR_FinishRound (CS_TEAM_NONE);
1521+ return true ;
1522+ }
1523+ }
1524+
14861525 if (!g_hRespawnToggler.IsValid ())
1487- return ;
1526+ return true ;
14881527
14891528 CBaseEntity* relay = g_hRespawnToggler.Get ();
1490- const char * inputName = pInputName->String ();
14911529
14921530 // Must be an input into our zr_toggle_respawn relay
14931531 if (!relay || pThis != relay->m_pEntity )
1494- return ;
1532+ return true ;
14951533
14961534 if (!V_strcasecmp (inputName, " Trigger" ))
14971535 ToggleRespawn ();
@@ -1500,9 +1538,10 @@ void ZR_Detour_CEntityIdentity_AcceptInput(CEntityIdentity* pThis, CUtlSymbolLar
15001538 else if (!V_strcasecmp (inputName, " Disable" ) && g_bRespawnEnabled)
15011539 ToggleRespawn (true , false );
15021540 else
1503- return ;
1541+ return true ;
15041542
15051543 ClientPrintAll (HUD_PRINTTALK, ZR_PREFIX " Respawning is %s!" , g_bRespawnEnabled ? " enabled" : " disabled" );
1544+ return true ;
15061545}
15071546
15081547void SpawnPlayer (CCSPlayerController* pController)
@@ -1645,7 +1684,7 @@ void ZR_OnRoundTimeWarning(IGameEvent* pEvent)
16451684 CTimer::Create (10.0 , TIMERFLAG_MAP | TIMERFLAG_ROUND, []() {
16461685 if (g_ZRRoundState == EZRRoundState::ROUND_END)
16471686 return -1 .0f ;
1648- ZR_EndRoundAndAddTeamScore (g_cvarDefaultWinnerTeam.Get ());
1687+ ZR_EndRound (g_cvarDefaultWinnerTeam.Get ());
16491688 return -1 .0f ;
16501689 });
16511690}
@@ -1676,15 +1715,12 @@ bool ZR_CheckTeamWinConditions(int iTeamNum)
16761715 return false ;
16771716
16781717 // allow the team to win
1679- ZR_EndRoundAndAddTeamScore (iTeamNum);
1718+ ZR_EndRound (iTeamNum);
16801719
16811720 return true ;
16821721}
16831722
1684- // spectator: draw
1685- // t: t win, add t score
1686- // ct: ct win, add ct score
1687- void ZR_EndRoundAndAddTeamScore (int iTeamNum)
1723+ void ZR_EndRound (int iTeamNum)
16881724{
16891725 bool bServerIdle = true ;
16901726
@@ -1709,22 +1745,26 @@ void ZR_EndRoundAndAddTeamScore(int iTeamNum)
17091745 CSRoundEndReason iReason;
17101746 switch (iTeamNum)
17111747 {
1712- default :
1713- case CS_TEAM_SPECTATOR:
1714- iReason = CSRoundEndReason::Draw;
1715- break ;
17161748 case CS_TEAM_T:
17171749 iReason = CSRoundEndReason::TerroristWin;
17181750 break ;
17191751 case CS_TEAM_CT:
17201752 iReason = CSRoundEndReason::CTWin;
17211753 break ;
1754+ default :
1755+ iReason = CSRoundEndReason::Draw;
1756+ break ;
17221757 }
17231758
17241759 static ConVarRefAbstract mp_round_restart_delay (" mp_round_restart_delay" );
17251760 float flRestartDelay = mp_round_restart_delay.GetFloat ();
17261761
17271762 g_pGameRules->TerminateRound (flRestartDelay, iReason);
1763+ ZR_FinishRound (iTeamNum);
1764+ }
1765+
1766+ void ZR_FinishRound (int iTeamNum)
1767+ {
17281768 g_ZRRoundState = EZRRoundState::ROUND_END;
17291769 ToggleRespawn (true , false );
17301770
0 commit comments