r3657 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat May 24 12:22:19 EDT 2008


Author: greenmarine
Date: 2008-05-24 12:22:19 -0400 (Sat, 24 May 2008)
New Revision: 3657

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/clientcommands.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/teamplay.qc
Log:
new feature: g_tourney
- splits the game into warmup and match stage
- After a new map is loaded the game is automatically in warmup-stage. Players are able to get from warmup- to match-stage by reading up. During warmup-stage the players automatically have all weapons (with appropriate ammo) and much health and armor. The amount of health, armor and ammunition is defined in the g_tourney_start_xxxx variables. However, the map also has all the items like health, ammo and weapons that can be picked up.
- spectator chat can be limited so that only specs can talk to each other, so players won't be disturbed during the match
- admin can forbid spectators to call a vote

Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-05-24 14:01:14 UTC (rev 3656)
+++ trunk/data/defaultNexuiz.cfg	2008-05-24 16:22:19 UTC (rev 3657)
@@ -127,6 +127,18 @@
 set g_maxplayers 0 //maximum number of players allowed to play at the same time, set to 0 to all players to join the game
 set g_maxplayers_spectator_blocktime 5 //if the players voted for the "nospectators" command, this setting defines the number of seconds a observer/spectator has time to join the game before he gets kicked
 
+//tournament mod
+set g_tourney 0 //enables tourney mode which splits the game into a warmup- and match-stage
+set g_tourney_warmup_unlimited_time 1 //if set the warmup-stage is not affected by any timelimit, otherwise the usual timelimit also affects warmup-stage
+set g_tourney_disable_spec_chat 1 //if set the chat sent by spectators or observers while being in match-stage can only seen by other specs/observers
+set g_tourney_disable_spec_vote 1 //if set only players can call a vote during the match-stage (thus spectators and observers can't call a vote then)
+set g_tourney_start_health 250 //starting values when being in warmup-stage
+set g_tourney_start_armor 100
+set g_tourney_start_ammo_shells 50
+set g_tourney_start_ammo_nails 150
+set g_tourney_start_ammo_rockets 50
+set g_tourney_start_ammo_cells 50
+
 // use default physics
 exec physicsQBR.cfg
 

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2008-05-24 14:01:14 UTC (rev 3656)
+++ trunk/data/qcsrc/server/clientcommands.qc	2008-05-24 16:22:19 UTC (rev 3657)
@@ -123,7 +123,15 @@
 	}
 	else
 	{
-		bprint(msgstr);
+		//when g_tourney is active and g_tourney_disable_spec_chat is set and game is in matchstage
+		//don't print the text from specs/observers to the players but only the other spectators
+		if(g_tourney && cvar("g_tourney_disable_spec_chat") && tourneyInMatchStage && source.classname != "player") {
+			FOR_EACH_REALCLIENT(head) if(head.classname != "player") {
+				sprint(head, msgstr);
+			}
+		}
+		else
+			bprint(msgstr);
 		//ServerConsoleEcho(substring(msgstr, 1, strlen(msgstr) - 2), TRUE);
 	}
 
@@ -231,7 +239,10 @@
 			}
 		} else if(argv(1) == "call") {
 			if(cvar("sv_vote_call")) {
-				if(votecalled) {
+				if(tourneyInMatchStage && cvar("g_tourney_disable_spec_vote") && self.classname != "player") {
+					sprint(self, "^1Error: Only players can call a vote during the match-stage.\n");
+				}
+				else if(votecalled) {
 					sprint(self, "^1There is already a vote called.\n");
 				} else {
 					local string vote;
@@ -701,7 +712,17 @@
 	{
 		votecaller.vote_master = 1;
 	} else {
-		localcmd(strcat(votecalledvote, "\n"));
+		//in g_tourney mode and if the vote is a timelimit-change, don't change it immediately but after restart
+		if(cvar("g_tourney") && substring(votecalledvote, 0, 10) == "timelimit ") {
+			if( stof(substring(votecalledvote, 10, strlen(votecalledvote) - 10)) > 0 ) {
+				timelimit_orig = stof(substring(votecalledvote, 10, strlen(votecalledvote) - 10));
+				bprint(strcat("The timelimit will be set to ", ftos(timelimit_orig), " minutes after the next restart!\n"));
+			}
+			else //calls like "timelimit -1" can pass immediately
+				localcmd(strcat(votecalledvote, "\n"));
+		}
+		else
+			localcmd(strcat(votecalledvote, "\n"));
 	}
 	votecaller.vote_next = 0; // people like your votes, no wait for next vote
 	VoteReset();
@@ -763,6 +784,12 @@
 	local float abstaincount;
 	abstaincount = 0;
 	local entity player;
+	//same for real players
+	local float realplayercount;
+	local float realplayeryescount;
+	local float realplayernocount;
+	local float realplayerabstaincount;
+	realplayercount = realplayernocount = realplayerabstaincount = realplayeryescount = 0;
 
 	FOR_EACH_REALCLIENT(player)
 	{
@@ -774,8 +801,28 @@
 			abstaincount++;
 		}
 		playercount++;
+		//do the same for real players
+		if(player.classname == "player") {
+			if(player.vote_vote == -1) {
+				realplayernocount++;
+			} else if(player.vote_vote == 1) {
+				realplayeryescount++;
+			} else if(player.vote_vote == -2) {
+				realplayerabstaincount++;
+			}
+			realplayercount++;
+		}
 	}
 
+	//in tournament mode, if we have at least one player then don't make the vote dependent on spectators (so specs don't have to press F1)
+	if( cvar("g_tourney") && (realplayercount > 0) ) {
+		yescount = realplayeryescount;
+		nocount = realplayernocount;
+		abstaincount = realplayerabstaincount;
+		playercount = realplayercount;
+	}
+
+
 	if((playercount == 1) && votecalledmaster) {
 		// if only one player is on the server becoming vote
 		// master is not allowed.  This could be used for
@@ -820,8 +867,6 @@
 	}
 }
 
-float timelimit_orig;
-
 /**
  * Counts how many players are ready. If not enough players are ready, the function
  * does nothing. If all players are ready, the timelimit will be extended and the
@@ -867,6 +912,19 @@
 		remove(readyNagger);
 	}
 
+	if(g_tourney) {
+		tourneyInMatchStage = 1; //once the game is restarted the game is in match stage
+		//reset weapons and ammo, health and armor to default:
+		start_items = IT_LASER | IT_SHOTGUN;
+		start_switchweapon = WEP_SHOTGUN;
+		start_ammo_shells = cvar("g_start_ammo_shells");
+		start_ammo_nails = cvar("g_start_ammo_nails");
+		start_ammo_rockets = cvar("g_start_ammo_rockets");
+		start_ammo_cells = cvar("g_start_ammo_cells");
+		start_health = cvar("g_balance_health_start");
+		start_armorvalue = cvar("g_balance_armor_start");
+	}
+
 	restart_countdown = time + RESTART_COUNTDOWN;
 	restart_mapalreadyrestarted = 0; //reset this var, needed when cvar sv_ready_restart_repeatable is in use
 	//reset the .ready status of all players (also spectators)
@@ -874,12 +932,14 @@
 	{
 		e.ready = 0;
 	}
-	if(0<cvar("timelimit"))
+	if(0<cvar("timelimit") || (g_tourney && cvar("g_tourney_warmup_unlimited_time")) )
 	{
 		// remember original timelimit on first restart
 		if(!timelimit_orig)
 			timelimit_orig = cvar("timelimit");
-		cvar_set("timelimit", ftos(timelimit_orig + ceil(restart_countdown)/60));
+		//only set the new timelimit if, when loading the map, a timelimit was really set
+		if(timelimit_orig)
+			cvar_set("timelimit", ftos(timelimit_orig + ceil(restart_countdown)/60));
 	}
 	if(cvar("teamplay_lockonrestart") && teams_matter) {
 		lockteams = 1;

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2008-05-24 14:01:14 UTC (rev 3656)
+++ trunk/data/qcsrc/server/defs.qh	2008-05-24 16:22:19 UTC (rev 3657)
@@ -4,6 +4,8 @@
 
 float g_domination, g_ctf, g_tdm, g_keyhunt, g_onslaught, g_assault, g_arena, g_lms, g_runematch;
 float g_cloaked, g_footsteps, g_grappling_hook, g_instagib, g_laserguided_missile, g_midair, g_minstagib, g_nixnex, g_nixnex_with_laser, g_norecoil, g_rocketarena, g_vampire, g_minstagib_invis_alpha;
+float g_tourney;
+float tourneyInMatchStage;
 
 float sv_cheats;
 
@@ -282,6 +284,7 @@
 float blockSpectators; //if set, new or existing spectators or observers will be removed unless they become a player within g_maxplayers_spectator_blocktime seconds
 .float spectatortime; //point in time since the client is spectating or observing
 void checkSpectatorBlock();
+float timelimit_orig;
 
 .float winning;
 .float deaths;

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2008-05-24 14:01:14 UTC (rev 3656)
+++ trunk/data/qcsrc/server/g_world.qc	2008-05-24 16:22:19 UTC (rev 3657)
@@ -245,6 +245,12 @@
 	MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 1);
 #endif
 
+	//if tourney is used map starts in warmup mode. if this mode shall stay unlimited, reset timelimit, but save the original one
+	if(g_tourney && cvar("g_tourney_warmup_unlimited_time")) {
+		timelimit_orig = cvar("timelimit");
+		cvar_set("timelimit", "0");
+	}
+
 	world_initialized = 1;
 }
 

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2008-05-24 14:01:14 UTC (rev 3656)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2008-05-24 16:22:19 UTC (rev 3657)
@@ -733,6 +733,7 @@
 	g_norecoil = cvar("g_norecoil");
 	g_rocketarena = cvar("g_rocketarena");
 	g_vampire = cvar("g_vampire");
+	g_tourney = cvar("g_tourney");
 
 	g_pickup_shells                    = cvar("g_pickup_shells");
 	g_pickup_shells_max                = cvar("g_pickup_shells_max");
@@ -807,6 +808,14 @@
 			start_health = cvar("g_lms_start_health");
 			start_armorvalue = cvar("g_lms_start_armor");
 		}
+		else if(g_tourney) {
+			start_ammo_shells = cvar("g_tourney_start_ammo_shells");
+			start_ammo_nails = cvar("g_tourney_start_ammo_nails");
+			start_ammo_rockets = cvar("g_tourney_start_ammo_rockets");
+			start_ammo_cells = cvar("g_tourney_start_ammo_cells");
+			start_health = cvar("g_tourney_start_health");
+			start_armorvalue = cvar("g_tourney_start_armor");
+		}
 		else if (cvar("g_use_ammunition")) {
 			start_ammo_shells = cvar("g_start_ammo_shells");
 			start_ammo_nails = cvar("g_start_ammo_nails");
@@ -831,43 +840,43 @@
 			start_switchweapon = WEP_SHOTGUN;
 			weapon_action(start_switchweapon, WR_PRECACHE);
 		}
-		if (cvar("g_start_weapon_uzi") || g_lms)
+		if (cvar("g_start_weapon_uzi") || g_lms || g_tourney)
 		{
 			start_items = start_items | IT_UZI;
 			start_switchweapon = WEP_UZI;
 			weapon_action(start_switchweapon, WR_PRECACHE);
 		}
-		if (cvar("g_start_weapon_grenadelauncher") || g_lms)
+		if (cvar("g_start_weapon_grenadelauncher") || g_lms || g_tourney)
 		{
 			start_items = start_items | IT_GRENADE_LAUNCHER;
 			start_switchweapon = WEP_GRENADE_LAUNCHER;
 			weapon_action(start_switchweapon, WR_PRECACHE);
 		}
-		if (cvar("g_start_weapon_electro") || g_lms)
+		if (cvar("g_start_weapon_electro") || g_lms || g_tourney)
 		{
 			start_items = start_items | IT_ELECTRO;
 			start_switchweapon = WEP_ELECTRO;
 			weapon_action(start_switchweapon, WR_PRECACHE);
 		}
-		if (cvar("g_start_weapon_crylink") || g_lms)
+		if (cvar("g_start_weapon_crylink") || g_lms || g_tourney)
 		{
 			start_items = start_items | IT_CRYLINK;
 			start_switchweapon = WEP_CRYLINK;
 			weapon_action(start_switchweapon, WR_PRECACHE);
 		}
-		if (cvar("g_start_weapon_nex") || g_lms)
+		if (cvar("g_start_weapon_nex") || g_lms || g_tourney)
 		{
 			start_items = start_items | IT_NEX;
 			start_switchweapon = WEP_NEX;
 			weapon_action(start_switchweapon, WR_PRECACHE);
 		}
-		if (cvar("g_start_weapon_hagar") || g_lms)
+		if (cvar("g_start_weapon_hagar") || g_lms || g_tourney)
 		{
 			start_items = start_items | IT_HAGAR;
 			start_switchweapon = WEP_HAGAR;
 			weapon_action(start_switchweapon, WR_PRECACHE);
 		}
-		if (cvar("g_start_weapon_rocketlauncher") || g_lms)
+		if (cvar("g_start_weapon_rocketlauncher") || g_lms || g_tourney)
 		{
 			start_items = start_items | IT_ROCKET_LAUNCHER;
 			start_switchweapon = WEP_ROCKET_LAUNCHER;

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2008-05-24 14:01:14 UTC (rev 3656)
+++ trunk/data/qcsrc/server/teamplay.qc	2008-05-24 16:22:19 UTC (rev 3657)
@@ -418,6 +418,12 @@
 		}
 		modifications = strcat(modifications, "laser-guided-missiles");
 	}
+	if(g_tourney) {
+		if (modifications) {
+			modifications = strcat(modifications, ", ");
+		}
+		modifications = strcat(modifications, "Tournament");
+	}
 
 	local string versionmessage;
 	versionmessage = GetClientVersionMessage(self.version);
@@ -428,6 +434,13 @@
 	if(modifications != "")
 		s = strcat(s, "^8\nactive modifications: ^3", modifications, "^8\n");
 
+	if(g_tourney) {
+		if(!tourneyInMatchStage)
+			s = strcat(s, "\n^8The game is currently in ^3warmup-stage ^8!\n");
+		else
+			s = strcat(s, "\n^8The game is currently in ^3match-stage ^8!\n");
+	}
+
 	if(time < restart_countdown)
 		s = strcat(s, "\n^1Game starts in ", ftos(restartAnnouncer.cnt + 1), " seconds^7");
 




More information about the nexuiz-commits mailing list