Add sv_team 3 (forced random team for you, useful for solo ddrace)

This commit is contained in:
def 2013-12-19 23:04:01 +01:00
parent 652d742d6a
commit 0b70f874dc
4 changed files with 16 additions and 4 deletions

View file

@ -176,7 +176,7 @@ MACRO_CONFIG_STR(SvRulesLine8, sv_rules_line8, 40, "", CFGFLAG_SERVER, "Rules li
MACRO_CONFIG_STR(SvRulesLine9, sv_rules_line9, 40, "", CFGFLAG_SERVER, "Rules line 9")
MACRO_CONFIG_STR(SvRulesLine10, sv_rules_line10, 40, "", CFGFLAG_SERVER, "Rules line 10")
MACRO_CONFIG_INT(SvTeam, sv_team, 1, 0, 2, CFGFLAG_SERVER, "Teams configuration (0 = off, 1 = on but optional, 2 = must play only with teams)")
MACRO_CONFIG_INT(SvTeam, sv_team, 1, 0, 3, CFGFLAG_SERVER, "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, 16, 2, 16, CFGFLAG_SERVER, "Maximum team size (from 2 to 16)")
MACRO_CONFIG_STR(SvAnnouncementFileName, sv_announcement_filename, 24, "announcement.txt", CFGFLAG_SERVER, "file which will have the announcement, each one at a line")

View file

@ -115,7 +115,7 @@ void CGameContext::ConSettings(IConsole::IResult *pResult, void *pUserData)
"%s %s",
g_Config.m_SvTeam == 1 ?
"Teams are available on this server" :
!g_Config.m_SvTeam ?
(g_Config.m_SvTeam == 0 || g_Config.m_SvTeam == 3) ?
"Teams are not available on this server" :
"You have to be in a team to play on this server", /*g_Config.m_SvTeamStrict ? "and if you die in a team all of you die" : */
"and if you die in a team only you die");
@ -660,7 +660,7 @@ void CGameContext::ConJoinTeam(IConsole::IResult *pResult, void *pUserData)
"You are running a vote please try again after the vote is done!");
return;
}
else if (g_Config.m_SvTeam == 0)
else if (g_Config.m_SvTeam == 0 || g_Config.m_SvTeam == 3)
{
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join",
"Admin has disabled teams");

View file

@ -411,10 +411,22 @@ void CPlayer::TryRespawn()
if(!GameServer()->m_pController->CanSpawn(m_Team, &SpawnPos))
return;
CGameControllerDDRace* Controller = (CGameControllerDDRace*)GameServer()->m_pController;
m_Spawning = false;
m_pCharacter = new(m_ClientID) CCharacter(&GameServer()->m_World);
m_pCharacter->Spawn(this, SpawnPos);
GameServer()->CreatePlayerSpawn(SpawnPos, m_pCharacter->Teams()->TeamMask(m_pCharacter->Team(), -1, m_ClientID));
int NewTeam = 1;
if(g_Config.m_SvTeam == 3)
{
for(; NewTeam < TEAM_SUPER; NewTeam++)
if(Controller->m_Teams.Count(NewTeam) == 0)
break;
Controller->m_Teams.SetCharacterTeam(GetCID(), NewTeam);
}
}
bool CPlayer::AfkTimer(int NewTargetX, int NewTargetY)

View file

@ -6,7 +6,7 @@
enum
{
TEAM_FLOCK = 0, TEAM_SUPER = 16
TEAM_FLOCK = 0, TEAM_SUPER = 17
};
class CTeamsCore