X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fteamplay.qc;h=f9321b8dbf0fdbab6b3af8caf9b833af7add3c20;hb=4aabbcbfcb5d689c7553db92012b7db84b867afa;hp=925739e308e45683ecd20342cee99d95d55c522d;hpb=c3ae796ada5970dfaa3f78eced7a3719ab26e75e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 925739e30..f9321b8db 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -517,18 +517,18 @@ void PrintWelcomeMessage(entity pl) modifications = strcat(modifications, ", No start weapons"); if(autocvar_sv_gravity < 800) modifications = strcat(modifications, ", Low gravity"); - if(g_cloaked) + if(g_cloaked && !g_cts) modifications = strcat(modifications, ", Cloaked"); if(g_grappling_hook) modifications = strcat(modifications, ", Hook"); if(g_midair) modifications = strcat(modifications, ", Midair"); if(g_pinata) - modifications = strcat(modifications, ", Pinata"); - if(g_weapon_stay) + modifications = strcat(modifications, ", Piñata"); + if(g_weapon_stay && !g_cts) modifications = strcat(modifications, ", Weapons stay"); if(g_bloodloss > 0) - modifications = strcat(modifications, ", Bloodloss"); + modifications = strcat(modifications, ", Blood loss"); if(g_jetpack) modifications = strcat(modifications, ", Jet pack"); modifications = substring(modifications, 2, strlen(modifications) - 2); @@ -627,11 +627,7 @@ void CheckAllowedTeams (entity for_whom) c1 = c2 = c3 = c4 = -1; cb1 = cb2 = cb3 = cb4 = 0; - if(autocvar_g_campaign && for_whom && clienttype(for_whom) == CLIENTTYPE_REAL) - { - c1 = 0; // only allow RED team for player joining - } - else if(g_onslaught) + if(g_onslaught) { // onslaught is special head = findchain(classname, "onslaught_generator"); @@ -747,8 +743,15 @@ void GetTeamCounts(entity ignore) // FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around) // also remember the lowest-scoring player - FOR_EACH_PLAYER(head) + FOR_EACH_CLIENT(head) { + float t; + if(head.classname == "player") + t = head.team; + else if(head.team_forced > 0) + t = head.team_forced; // reserve the spot + else + continue; if(head != ignore)// && head.netname != "") { value = PlayerValue(head); @@ -756,7 +759,7 @@ void GetTeamCounts(entity ignore) bvalue = value; else bvalue = 0; - if(head.team == COLOR_TEAM1) + if(t == COLOR_TEAM1) { if(c1 >= 0) { @@ -764,7 +767,7 @@ void GetTeamCounts(entity ignore) cb1 = cb1 + bvalue; } } - if(head.team == COLOR_TEAM2) + if(t == COLOR_TEAM2) { if(c2 >= 0) { @@ -772,7 +775,7 @@ void GetTeamCounts(entity ignore) cb2 = cb2 + bvalue; } } - if(head.team == COLOR_TEAM3) + if(t == COLOR_TEAM3) { if(c3 >= 0) { @@ -780,7 +783,7 @@ void GetTeamCounts(entity ignore) cb3 = cb3 + bvalue; } } - if(head.team == COLOR_TEAM4) + if(t == COLOR_TEAM4) { if(c4 >= 0) { @@ -790,6 +793,18 @@ void GetTeamCounts(entity ignore) } } } + + // if the player who has a forced team has not joined yet, reserve the spot + if(autocvar_g_campaign) + { + switch(autocvar_g_campaign_forceteam) + { + case 1: if(c1 == cb1) ++c1; break; + case 2: if(c2 == cb2) ++c2; break; + case 3: if(c3 == cb3) ++c3; break; + case 4: if(c4 == cb4) ++c4; break; + } + } } // returns # of smallest team (1, 2, 3, 4) @@ -894,33 +909,6 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) // find out what teams are available CheckAllowedTeams(pl); - // if we want the player in a certain team for campaign, force him there - if(autocvar_g_campaign) - if(clienttype(pl) == CLIENTTYPE_REAL) // only players, not bots - { - switch(autocvar_g_campaign_forceteam) - { - case 1: - SetPlayerColors(pl, COLOR_TEAM1 - 1); - LogTeamchange(pl.playerid, pl.team, 2); - return COLOR_TEAM1; - case 2: - SetPlayerColors(pl, COLOR_TEAM2 - 1); - LogTeamchange(pl.playerid, pl.team, 2); - return COLOR_TEAM2; - case 3: - SetPlayerColors(pl, COLOR_TEAM3 - 1); - LogTeamchange(pl.playerid, pl.team, 2); - return COLOR_TEAM3; - case 4: - SetPlayerColors(pl, COLOR_TEAM4 - 1); - LogTeamchange(pl.playerid, pl.team, 2); - return COLOR_TEAM4; - default: - break; - } - } - // if we don't care what team he ends up on, put him on whatever team he entered as. // if he's not on a valid team, then let other code put him on the smallest team if(!forcebestteam)