| 76 | } |
| 77 | |
| 78 | void CGameTeams::OnCharacterStart(int ClientId) |
| 79 | { |
| 80 | int Tick = Server()->Tick(); |
| 81 | CCharacter *pStartingChar = Character(ClientId); |
| 82 | if(!pStartingChar) |
| 83 | return; |
| 84 | if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO && pStartingChar->m_DDRaceState == ERaceState::STARTED) |
| 85 | return; |
| 86 | if((g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO || (m_Core.Team(ClientId) != TEAM_FLOCK && !m_aTeamFlock[m_Core.Team(ClientId)])) && pStartingChar->m_DDRaceState == ERaceState::FINISHED) |
| 87 | return; |
| 88 | if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && |
| 89 | (m_Core.Team(ClientId) == TEAM_FLOCK || TeamFlock(m_Core.Team(ClientId)) || m_Core.Team(ClientId) == TEAM_SUPER)) |
| 90 | { |
| 91 | if(TeamFlock(m_Core.Team(ClientId)) && (m_aTeamState[m_Core.Team(ClientId)] < ETeamState::STARTED)) |
| 92 | ChangeTeamState(m_Core.Team(ClientId), ETeamState::STARTED); |
| 93 | |
| 94 | m_aTeeStarted[ClientId] = true; |
| 95 | pStartingChar->m_DDRaceState = ERaceState::STARTED; |
| 96 | pStartingChar->m_StartTime = Tick; |
| 97 | return; |
| 98 | } |
| 99 | bool Waiting = false; |
| 100 | for(int i = 0; i < MAX_CLIENTS; ++i) |
| 101 | { |
| 102 | if(m_Core.Team(ClientId) != m_Core.Team(i)) |
| 103 | continue; |
| 104 | CPlayer *pPlayer = GetPlayer(i); |
| 105 | if(!pPlayer || !pPlayer->IsPlaying()) |
| 106 | continue; |
| 107 | if(GetDDRaceState(pPlayer) != ERaceState::FINISHED) |
| 108 | continue; |
| 109 | |
| 110 | Waiting = true; |
| 111 | pStartingChar->m_DDRaceState = ERaceState::NONE; |
| 112 | |
| 113 | if(m_aLastChat[ClientId] + Server()->TickSpeed() + g_Config.m_SvChatDelay < Tick) |
| 114 | { |
| 115 | char aBuf[128]; |
| 116 | str_format( |
| 117 | aBuf, |
| 118 | sizeof(aBuf), |
| 119 | "%s has finished and didn't go through start yet, wait for them or join another team.", |
| 120 | Server()->ClientName(i)); |
| 121 | GameServer()->SendChatTarget(ClientId, aBuf); |
| 122 | m_aLastChat[ClientId] = Tick; |
| 123 | } |
| 124 | if(m_aLastChat[i] + Server()->TickSpeed() + g_Config.m_SvChatDelay < Tick) |
| 125 | { |
| 126 | char aBuf[128]; |
| 127 | str_format( |
| 128 | aBuf, |
| 129 | sizeof(aBuf), |
| 130 | "%s wants to start a new round, kill or walk to start.", |
| 131 | Server()->ClientName(ClientId)); |
| 132 | GameServer()->SendChatTarget(i, aBuf); |
| 133 | m_aLastChat[i] = Tick; |
| 134 | } |
| 135 | } |
no test coverage detected