r3714 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Jun 20 09:40:12 EDT 2008


Author: div0
Date: 2008-06-20 09:40:09 -0400 (Fri, 20 Jun 2008)
New Revision: 3714

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/gamecommand.qc
   trunk/data/qcsrc/server/teamplay.qc
Log:
server admin commands: movetoteam_*


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-06-20 12:31:20 UTC (rev 3713)
+++ trunk/data/defaultNexuiz.cfg	2008-06-20 13:40:09 UTC (rev 3714)
@@ -61,6 +61,12 @@
 alias team_auto "cmd selectteam auto; cmd join"
 bind f6 team_auto
 
+alias movetoteam_red "sv_cmd movetoteam $1 red"
+alias movetoteam_blue "sv_cmd movetoteam $1 blue"
+alias movetoteam_pink "sv_cmd movetoteam $1 pink"
+alias movetoteam_yellow "sv_cmd movetoteam $1 yellow"
+alias movetoteam_auto "sv_cmd movetoteam $1 auto"
+
 // merge lightmaps up to 1024x1024 textures
 // the default of 2048x2048 is too heavy for my rig (SavageX)
 mod_q3bsp_lightmapmergepower 3

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-06-20 12:31:20 UTC (rev 3713)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-06-20 13:40:09 UTC (rev 3714)
@@ -815,12 +815,48 @@
 
 void DoTeamChange(float destteam)
 {
+	float t, c0;
 	if(!cvar("teamplay"))
 	{
 		if(destteam >= 0)
 			SetPlayerColors(self, destteam);
 		return;
 	}
+	if(self.classname == "player")
+	if(destteam == -1)
+	{
+		CheckAllowedTeams(self);
+		t = FindSmallestTeam(self, TRUE);
+		switch(self.team)
+		{
+			case COLOR_TEAM1: c0 = c1; break;
+			case COLOR_TEAM2: c0 = c2; break;
+			case COLOR_TEAM3: c0 = c3; break;
+			case COLOR_TEAM4: c0 = c4; break;
+			default:          c0 = 99;
+		}
+		switch(t)
+		{
+			case 1:
+				if(c0 > c1)
+					destteam = COLOR_TEAM1;
+				break;
+			case 2:
+				if(c0 > c2)
+					destteam = COLOR_TEAM2;
+				break;
+			case 3:
+				if(c0 > c3)
+					destteam = COLOR_TEAM3;
+				break;
+			case 4:
+				if(c0 > c4)
+					destteam = COLOR_TEAM4;
+				break;
+		}
+		if(destteam == -1)
+			return;
+	}
 	if(destteam == self.team && !self.killindicator)
 		return;
 	ClientKill_TeamChange(destteam);

Modified: trunk/data/qcsrc/server/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/server/gamecommand.qc	2008-06-20 12:31:20 UTC (rev 3713)
+++ trunk/data/qcsrc/server/gamecommand.qc	2008-06-20 13:40:09 UTC (rev 3714)
@@ -18,6 +18,8 @@
 void GameCommand(string command)
 {
 	float argc;
+	entity client;
+	float entno;
 	argc = tokenize(command);
 
 	if(argv(0) == "help" || argc == 0)
@@ -112,8 +114,6 @@
 
 	if(argv(0) == "adminmsg") if(argc == 3)
 	{
-		entity client;
-		float entno;
 		entno = stof(argv(1));
 		client = world;
 		if(entno <= maxclients)
@@ -187,7 +187,28 @@
 			bprint("That command can only be used in a team-based gamemode.\n");
 		return;
 	}
+	if (argv(0) == "movetoteam") if(argc == 3)
+	{
+		entno = stof(argv(1));
+		client = world;
+		if(entno <= maxclients)
+			client = edict_num(entno);
+		if(client.flags & FL_CLIENT)
+		{
+			float lt;
+			lt = lockteams;
+			lockteams = 0;
 
+			self = client;
+			SV_ParseClientCommand(strcat("selectteam ", argv(2)));
+
+			lockteams = lt;
+		}
+		else
+			print("Client not found\n");
+		return;
+	}
+
 	print("Invalid command. For a list of supported commands, try sv_cmd help.\n");
 }
 

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2008-06-20 12:31:20 UTC (rev 3713)
+++ trunk/data/qcsrc/server/teamplay.qc	2008-06-20 13:40:09 UTC (rev 3714)
@@ -759,7 +759,6 @@
 			error("Too few teams available for team deathmatch\n");
 	}
 
-
 	// count how many players are in each team
 	if(ignore_pl)
 		GetTeamCounts(pl);
@@ -858,6 +857,7 @@
 
 	if(g_domination)
 	{
+		// <div0> WHY? TODO
 		if(cvar("g_domination_default_teams") < 3)
 			c3 = 999999999;
 		if(cvar("g_domination_default_teams") < 4)




More information about the nexuiz-commits mailing list