mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Implement sv_min_team_size
to prevent too small teams counting as team finishes. You can still finish with a team smaller than sv_min_team_size, but only get regular ranks, not team ranks. This will require going through all our maps and setting sv_min_team_size in map config for maps intended for more than 2 players. We will also need to remove all teamranks with smaller teams from official database.
This commit is contained in:
parent
d4f126810b
commit
73d8329c4a
|
@ -258,7 +258,8 @@ MACRO_CONFIG_STR(SvRulesLine9, sv_rules_line9, 128, "", CFGFLAG_SERVER, "Rules l
|
|||
MACRO_CONFIG_STR(SvRulesLine10, sv_rules_line10, 128, "", CFGFLAG_SERVER, "Rules line 10")
|
||||
|
||||
MACRO_CONFIG_INT(SvTeam, sv_team, 1, 0, 3, CFGFLAG_SERVER | CFGFLAG_GAME, "Teams configuration (0 = off, 1 = on but optional, 2 = must play only with teams, 3 = forced random team only for you)")
|
||||
MACRO_CONFIG_INT(SvTeamMaxSize, sv_max_team_size, MAX_CLIENTS, 1, MAX_CLIENTS, CFGFLAG_SERVER | CFGFLAG_GAME, "Maximum team size (from 2 to 64)")
|
||||
MACRO_CONFIG_INT(SvMinTeamSize, sv_min_team_size, 2, 1, MAX_CLIENTS, CFGFLAG_SERVER | CFGFLAG_GAME, "Minimum team size (finishing in a team smaller than this size gives you no teamrank)")
|
||||
MACRO_CONFIG_INT(SvMaxTeamSize, sv_max_team_size, MAX_CLIENTS, 1, MAX_CLIENTS, CFGFLAG_SERVER | CFGFLAG_GAME, "Maximum team size")
|
||||
MACRO_CONFIG_INT(SvMapVote, sv_map_vote, 1, 0, 1, CFGFLAG_SERVER, "Whether to allow /map")
|
||||
|
||||
MACRO_CONFIG_STR(SvAnnouncementFileName, sv_announcement_filename, 24, "announcement.txt", CFGFLAG_SERVER, "file which will have the announcement, each one at a line")
|
||||
|
|
|
@ -1036,10 +1036,10 @@ void CGameContext::ConJoinTeam(IConsole::IResult *pResult, void *pUserData)
|
|||
"This team is locked using /lock. Only members of the team can unlock it using /lock." :
|
||||
"This team is locked using /lock. Only members of the team can invite you or unlock it using /lock.");
|
||||
}
|
||||
else if(Team > 0 && Team < MAX_CLIENTS && pController->m_Teams.Count(Team) >= g_Config.m_SvTeamMaxSize)
|
||||
else if(Team > 0 && Team < MAX_CLIENTS && pController->m_Teams.Count(Team) >= g_Config.m_SvMaxTeamSize)
|
||||
{
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "This team already has the maximum allowed size of %d players", g_Config.m_SvTeamMaxSize);
|
||||
str_format(aBuf, sizeof(aBuf), "This team already has the maximum allowed size of %d players", g_Config.m_SvMaxTeamSize);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join", aBuf);
|
||||
}
|
||||
else if(const char *pError = pController->m_Teams.SetCharacterTeam(pPlayer->GetCID(), Team))
|
||||
|
|
|
@ -2339,8 +2339,7 @@ void CCharacter::DDRaceInit()
|
|||
|
||||
if(g_Config.m_SvTeam == 2 && Team == TEAM_FLOCK)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "Please join a team before you start");
|
||||
m_LastStartWarning = Server()->Tick();
|
||||
GameServer()->SendStartWarning(GetPlayer()->GetCID(), "Please join a team before you start");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -464,6 +464,15 @@ void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText, in
|
|||
}
|
||||
}
|
||||
|
||||
void CGameContext::SendStartWarning(int ClientID, const char *pMessage)
|
||||
{
|
||||
CCharacter *pChr = GetPlayerChar(ClientID);
|
||||
if(pChr && pChr->m_LastStartWarning < Server()->Tick() - 3 * Server()->TickSpeed())
|
||||
{
|
||||
SendChatTarget(ClientID, pMessage);
|
||||
}
|
||||
}
|
||||
|
||||
void CGameContext::SendEmoticon(int ClientID, int Emoticon)
|
||||
{
|
||||
CNetMsg_Sv_Emoticon Msg;
|
||||
|
|
|
@ -219,6 +219,7 @@ public:
|
|||
void SendChatTarget(int To, const char *pText, int Flags = CHAT_SIX | CHAT_SIXUP);
|
||||
void SendChatTeam(int Team, const char *pText);
|
||||
void SendChat(int ClientID, int Team, const char *pText, int SpamProtectionClientID = -1, int Flags = CHAT_SIX | CHAT_SIXUP);
|
||||
void SendStartWarning(int ClientID, const char *pMessage);
|
||||
void SendEmoticon(int ClientID, int Emoticon);
|
||||
void SendWeaponPickup(int ClientID, int Weapon);
|
||||
void SendMotd(int ClientID);
|
||||
|
|
|
@ -66,7 +66,8 @@ void CGameControllerDDRace::HandleCharacterTiles(CCharacter *pChr, int MapIndex)
|
|||
// start
|
||||
if(IsOnStartTile && PlayerDDRaceState != DDRACE_CHEAT)
|
||||
{
|
||||
if(m_Teams.GetSaving(GetPlayerTeam(ClientID)))
|
||||
const int Team = GetPlayerTeam(ClientID);
|
||||
if(m_Teams.GetSaving(Team))
|
||||
{
|
||||
if(pChr->m_LastStartWarning < Server()->Tick() - 3 * Server()->TickSpeed())
|
||||
{
|
||||
|
@ -76,16 +77,18 @@ void CGameControllerDDRace::HandleCharacterTiles(CCharacter *pChr, int MapIndex)
|
|||
pChr->Die(ClientID, WEAPON_WORLD);
|
||||
return;
|
||||
}
|
||||
if(g_Config.m_SvTeam == 2 && (GetPlayerTeam(ClientID) == TEAM_FLOCK || m_Teams.Count(GetPlayerTeam(ClientID)) <= 1))
|
||||
if(g_Config.m_SvTeam == 2 && (Team == TEAM_FLOCK || m_Teams.Count(Team) <= 1))
|
||||
{
|
||||
if(pChr->m_LastStartWarning < Server()->Tick() - 3 * Server()->TickSpeed())
|
||||
{
|
||||
GameServer()->SendChatTarget(ClientID, "You have to be in a team with other tees to start");
|
||||
pChr->m_LastStartWarning = Server()->Tick();
|
||||
}
|
||||
GameServer()->SendStartWarning(ClientID, "You have to be in a team with other tees to start");
|
||||
pChr->Die(ClientID, WEAPON_WORLD);
|
||||
return;
|
||||
}
|
||||
if(Team > TEAM_FLOCK && Team < TEAM_SUPER && m_Teams.Count(Team) < g_Config.m_SvMinTeamSize)
|
||||
{
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), "Your team has fewer than %d players, so your team rank won't count", g_Config.m_SvMinTeamSize);
|
||||
GameServer()->SendStartWarning(ClientID, aBuf);
|
||||
}
|
||||
if(g_Config.m_SvResetPickups)
|
||||
{
|
||||
pChr->ResetPickups();
|
||||
|
|
|
@ -171,7 +171,7 @@ void CGameTeams::OnCharacterStart(int ClientID)
|
|||
}
|
||||
}
|
||||
|
||||
if(g_Config.m_SvTeam < 3 && g_Config.m_SvTeamMaxSize != 2 && g_Config.m_SvPauseable)
|
||||
if(g_Config.m_SvTeam < 3 && g_Config.m_SvMaxTeamSize != 2 && g_Config.m_SvPauseable)
|
||||
{
|
||||
for(int i = 0; i < MAX_CLIENTS; ++i)
|
||||
{
|
||||
|
@ -654,7 +654,7 @@ void CGameTeams::OnTeamFinish(CPlayer **Players, unsigned int Size, float Time,
|
|||
}
|
||||
}
|
||||
|
||||
if(Size >= 2)
|
||||
if(Size >= (unsigned int)g_Config.m_SvMinTeamSize)
|
||||
GameServer()->Score()->SaveTeamScore(PlayerCIDs, Size, Time, pTimestamp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue