r2810 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Sep 20 17:39:35 EDT 2007


Author: div0
Date: 2007-09-20 17:39:34 -0400 (Thu, 20 Sep 2007)
New Revision: 2810

Modified:
   trunk/data/default.cfg
   trunk/data/qcsrc/server/bots.qc
   trunk/data/qcsrc/server/teamplay.qc
Log:
new cvar bot_vs_human: set to positive value to make an all-bot blue team, set to negative value to make an all-bot red team, the absolute value is the ratio bots vs humans (1 for equal count)


Modified: trunk/data/default.cfg
===================================================================
--- trunk/data/default.cfg	2007-09-12 20:08:41 UTC (rev 2809)
+++ trunk/data/default.cfg	2007-09-20 21:39:34 UTC (rev 2810)
@@ -185,6 +185,7 @@
 set g_waypointeditor 0
 set bot_ignore_bots 0
 set bot_join_empty 0
+set bot_vs_human 0 // set to positive value to make an all-bot blue team, set to negative value to make an all-bot red team, the absolute value is the ratio bots vs humans (1 for equal count)
 
 alias g_waypointeditor_spawn "impulse 103"
 alias g_waypointeditor_remove "impulse 104"

Modified: trunk/data/qcsrc/server/bots.qc
===================================================================
--- trunk/data/qcsrc/server/bots.qc	2007-09-12 20:08:41 UTC (rev 2809)
+++ trunk/data/qcsrc/server/bots.qc	2007-09-20 21:39:34 UTC (rev 2810)
@@ -1899,12 +1899,12 @@
 	return bot;
 };
 
-void CheckAllowedTeams(); void GetTeamCounts(entity other); float c1, c2, c3, c4;
+void CheckAllowedTeams(entity for_whom); void GetTeamCounts(entity other); float c1, c2, c3, c4;
 void() bot_removefromlargestteam =
 {
 	local float besttime, bestcount, thiscount;
 	local entity best, head;
-	CheckAllowedTeams();
+	CheckAllowedTeams(world);
 	GetTeamCounts(world);
 	head = findchainfloat(isbot, TRUE);
 	if (!head)
@@ -2166,7 +2166,10 @@
 		minplayers = max(0, floor(realminplayers));
 
 		float realminbots, minbots;
-		realminbots = cvar("bot_number");
+		if(cvar("bot_vs_human"))
+			realminbots = ceil(fabs(cvar("bot_vs_human")) * activerealplayers);
+		else
+			realminbots = cvar("bot_number");
 		minbots = max(0, floor(realminbots));
 
 		bots = min(max(minbots, minplayers - activerealplayers), maxclients - realplayers);

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2007-09-12 20:08:41 UTC (rev 2809)
+++ trunk/data/qcsrc/server/teamplay.qc	2007-09-20 21:39:34 UTC (rev 2810)
@@ -522,7 +522,7 @@
 
 
 // set c1...c4 to show what teams are allowed
-void CheckAllowedTeams ()
+void CheckAllowedTeams (entity for_whom)
 {
 	string teament_name;
 	float dm;
@@ -605,6 +605,23 @@
 		}
 		head = find(head, classname, teament_name);
 	}
+
+	if(cvar("bot_vs_human") > 0)
+	{
+		// bots are all blue
+		if(clienttype(for_whom) == CLIENTTYPE_BOT)
+			c1 = c3 = c4 = -1;
+		else
+			c2 = -1;
+	}
+	else if(cvar("bot_vs_human") < 0)
+	{
+		// bots are all red
+		if(clienttype(for_whom) == CLIENTTYPE_BOT)
+			c2 = c3 = c4 = -1;
+		else
+			c1 = -1;
+	}
 }
 
 float PlayerValue(entity p)
@@ -690,6 +707,9 @@
 	if(c4 >= 0)
 		totalteams = totalteams + 1;
 
+	if(cvar("bot_vs_human"))
+		totalteams += 1;
+
 	if(totalteams <= 1)
 	{
 		if(g_domination)
@@ -797,7 +817,7 @@
 		return 0;
 
 	// find out what teams are available
-	CheckAllowedTeams();
+	CheckAllowedTeams(pl);
 
 	if(cvar("g_domination"))
 	{
@@ -918,12 +938,13 @@
 	}
 	*/
 
-	CheckAllowedTeams();
-	if(dteam == 3 && c3 < 0)
-		dteam = 2;
-	if(dteam == 4 && c4 < 0)
-		dteam = 1;
+	CheckAllowedTeams(self);
 
+	if(dteam == 1 && c1 < 0) dteam = 4;
+	if(dteam == 4 && c4 < 0) dteam = 3;
+	if(dteam == 3 && c3 < 0) dteam = 2;
+	if(dteam == 2 && c2 < 0) dteam = 1;
+
 	// not changing teams
 	if(scolor == dcolor)
 	{
@@ -945,7 +966,7 @@
 			// only allow changing to a smaller or equal size team
 
 			// find out what teams are available
-			CheckAllowedTeams();
+			//CheckAllowedTeams();
 			// count how many players on each team
 			GetTeamCounts(world);
 
@@ -1214,7 +1235,7 @@
 
 //	bprint("Auditing teams\n");
 
-	CheckAllowedTeams();
+	CheckAllowedTeams(world);
 	GetTeamCounts(world);
 
 




More information about the nexuiz-commits mailing list