r3630 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun May 18 05:12:16 EDT 2008


Author: greenmarine
Date: 2008-05-18 05:11:59 -0400 (Sun, 18 May 2008)
New Revision: 3630

Modified:
   trunk/data/default.cfg
   trunk/data/qcsrc/server/clientcommands.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/gamecommand.qc
Log:
Nifreks lockonrestart feature. Used in team-based game modes. Once all players are ready and teamplay_lockonrestart is set to 1, new spectators/observers cannot join the game anymore.
Other than that, the aliases lockteams and unlockteams can be used (e.g. as votable commands) to manually override the locks.

Modified: trunk/data/default.cfg
===================================================================
--- trunk/data/default.cfg	2008-05-17 20:21:36 UTC (rev 3629)
+++ trunk/data/default.cfg	2008-05-18 09:11:59 UTC (rev 3630)
@@ -35,6 +35,8 @@
 alias +hook +button6
 alias -hook -button6
 alias ready "cmd ready"
+alias lockteams "sv_cmd lockteams"
+alias unlockteams "sv_cmd unlockteams"
 
 alias bsp "ls maps/*.bsp"
 alias chmap "changelevel $*"
@@ -118,6 +120,9 @@
 set sv_ready_restart_nag_duration 6 //how long to show the ready-nag, in seconds
 set sv_ready_restart_nag_interval 10 //how long the pause between the ready-nags is, in seconds
 
+//nifreks lockonrestart feature, used in team-based game modes, if set to 1 and all players readied up no other player can then join the game anymore, useful to block spectators from joining
+set teamplay_lockonrestart 0
+
 // use default physics
 exec physicsQBR.cfg
 

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2008-05-17 20:21:36 UTC (rev 3629)
+++ trunk/data/qcsrc/server/clientcommands.qc	2008-05-18 09:11:59 UTC (rev 3630)
@@ -455,7 +455,7 @@
 		}
 	} else if(argv(0) == "join") {
 		if(!g_arena)
-		if (self.classname != "player")
+		if (self.classname != "player" && !lockteams)
 		{
 			self.classname = "player";
 			self.frags = 0;
@@ -467,6 +467,8 @@
 			sprint( self, "selecteam can only be used in teamgames\n");
 		} else if(cvar("g_campaign")) {
 			//JoinBestTeam(self, 0);
+		} else if(lockteams) {
+			sprint( self, "^7The game has already begun, you must wait until the next map to be able to join a team.\n");
 		} else if( argv(1) == "red" ) {
 			DoTeamChange(COLOR_TEAM1);
 		} else if( argv(1) == "blue" ) {
@@ -871,7 +873,11 @@
 			timelimit_orig = cvar("timelimit");
 		cvar_set("timelimit", ftos(timelimit_orig + ceil(restart_countdown)/60));
 	}
-
+	if(cvar("teamplay_lockonrestart") && teams_matter) {
+		lockteams = 1;
+		bprint("^1The teams are now locked.\n");
+	}
+	
 	//initiate the restart-countdown-announcer entity
 	restartAnnouncer = spawn();
 	restartAnnouncer.think = restartAnnouncer_Think;

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2008-05-17 20:21:36 UTC (rev 3629)
+++ trunk/data/qcsrc/server/defs.qh	2008-05-18 09:11:59 UTC (rev 3630)
@@ -402,3 +402,5 @@
 .float killindicator_teamchange;
 
 void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
+
+float lockteams;

Modified: trunk/data/qcsrc/server/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/server/gamecommand.qc	2008-05-17 20:21:36 UTC (rev 3629)
+++ trunk/data/qcsrc/server/gamecommand.qc	2008-05-18 09:11:59 UTC (rev 3630)
@@ -147,7 +147,28 @@
 		print("DB loaded.\n");
 		return;
 	}
-
+	if (argv(0) == "lockteams")
+	{
+		if(teamplay)
+		{
+			lockteams = 1;
+			bprint("^1The teams are now locked.\n");
+		}
+		else
+			bprint("That command can only be used in a team-based gamemode.\n");
+		return;
+	}
+	if (argv(0) == "unlockteams")
+	{
+		if(teamplay)
+		{
+			lockteams = 0;
+			bprint("^1The teams are now unlocked.\n");
+		}
+		else
+			bprint("That command can only be used in a team-based gamemode.\n");
+		return;
+	}
 	if(argv(0) == "vstop")
 	{
 		local entity temp;




More information about the nexuiz-commits mailing list