]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Other minor fixes of bot_vs_human:
authorterencehill <piuntn@gmail.com>
Mon, 20 Sep 2010 16:35:11 +0000 (18:35 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 20 Sep 2010 16:35:11 +0000 (18:35 +0200)
- Always check for available teams before reading bot_vs_human value, as it works only in games with 2 teams
- Do not read bot_join_empty and minplayers cvars when bot_vs_human is active, they are incompatible with it
- disable team nagger when bot_vs_human is active

qcsrc/server/bot/bot.qc
qcsrc/server/cl_client.qc
qcsrc/server/teamplay.qc

index 3ef50481dc5eb785e6cf2d60a0d26c47078b9436..a629b95a13bdbd7fc5713ca01dfa5a1247dcf88d 100644 (file)
@@ -555,17 +555,16 @@ void bot_serverframe()
        // But don't remove bots immediately on level change, as the real players
        // usually haven't rejoined yet
        bots_would_leave = FALSE;
-       if ((realplayers || cvar("bot_join_empty") || (currentbots > 0 && time < 5)))
+       if (teamplay && cvar("bot_vs_human") && (c3==-1 && c4==-1))
+               bots = min(ceil(fabs(cvar("bot_vs_human")) * activerealplayers), maxclients - realplayers);
+       else if ((realplayers || cvar("bot_join_empty") || (currentbots > 0 && time < 5)))
        {
                float realminplayers, minplayers;
                realminplayers = cvar("minplayers");
                minplayers = max(0, floor(realminplayers));
 
                float realminbots, minbots;
-               if(teamplay && cvar("bot_vs_human"))
-                       realminbots = ceil(fabs(cvar("bot_vs_human")) * activerealplayers);
-               else
-                       realminbots = cvar("bot_number");
+               realminbots = cvar("bot_number");
                minbots = max(0, floor(realminbots));
 
                bots = min(max(minbots, minplayers - activerealplayers), maxclients - realplayers);
index 9b53a1d955fed3949edbc2c1392bebf4aaf74485..ac33ddc50b1fb42a0a09cbd30453fdbe55df43f2 100644 (file)
@@ -1593,7 +1593,7 @@ void ClientConnect (void)
                        race_SendRankings(i, 0, 0, MSG_ONE);
                }
        }
-       else if(cvar("sv_teamnagger") && !g_ca) // teamnagger is currently bad for ca
+       else if(cvar("sv_teamnagger") && !(cvar("bot_vs_human") && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca
                send_CSQC_teamnagger();
 
        CheatInitClient();
index 0798b29b29b2769194190d7200d39ce3a6bd32ff..ce7402f8dcfa893289f0b590f57dff78a99101e8 100644 (file)
@@ -16,6 +16,8 @@ float IsTeamBalanceForced()
                return 0;
        if(cvar("g_campaign"))
                return 0;
+       if(cvar("bot_vs_human") && (c3==-1 && c4==-1))
+               return 0;
        if(!cvar("g_balance_teams_force"))
                return -1;
        return 1;
@@ -694,7 +696,7 @@ void CheckAllowedTeams (entity for_whom)
        }
 
        // TODO: Balance quantity of bots across > 2 teams when bot_vs_human is set (and remove next line)
-       if(c3==-1&&c4==-1)
+       if(c3==-1 && c4==-1)
        if(cvar("bot_vs_human") && for_whom)
        {
                if(cvar("bot_vs_human") > 0)
@@ -799,7 +801,7 @@ float FindSmallestTeam(entity pl, float ignore_pl)
        if(c4 >= 0)
                totalteams = totalteams + 1;
 
-       if(cvar("bot_vs_human"))
+       if(cvar("bot_vs_human") && totalteams == 1)
                totalteams += 1;
 
        if(totalteams <= 1)