r2647 - trunk/data/qcsrc/server

savagex at icculus.org savagex at icculus.org
Mon May 21 08:53:06 EDT 2007


Author: savagex
Date: 2007-05-21 08:53:06 -0400 (Mon, 21 May 2007)
New Revision: 2647

Modified:
   trunk/data/qcsrc/server/assault.qc
Log:
assault rounds now last 300 seconds by default (can be overridden with 
the health field of target_assault_roundend)


Modified: trunk/data/qcsrc/server/assault.qc
===================================================================
--- trunk/data/qcsrc/server/assault.qc	2007-05-21 10:44:12 UTC (rev 2646)
+++ trunk/data/qcsrc/server/assault.qc	2007-05-21 12:53:06 UTC (rev 2647)
@@ -296,8 +296,10 @@
 // reset objectives, toggle spawnpoints, reset triggers, ...
 void assault_new_round() {
 	
-	// this assumes self.classname == "func_assault_roundend"!
-	self.cnt = self.cnt + 1;
+	// up round counter
+	self.winning = self.winning + 1;
+	// set end time for next round
+	self.cnt = time + self.health;
 
 	// swap spawn point teams
 	local entity ent;
@@ -388,10 +390,35 @@
 
 }
 
+void assault_roundend_think() {
+	if(time > self.cnt)
+		assault_new_round();
+
+	local float timeleft;
+	timeleft = self.cnt - time;
+	timeleft = ceil(timeleft);
+
+	if(timeleft <= 10) {
+		local entity ent;
+		ent = find(world, classname, "player");
+		while(ent) {
+			centerprint(ent, ftos(timeleft));
+			ent = find(ent, classname, "player");
+		}
+	}
+
+	self.nextthink = time + 0.25;
+}
+
 void target_assault_roundend() {
-	self.cnt = 0; // round counter
+	if(!self.health)
+		self.health = 300; // 5 minutes
+	self.winning = 0; // round counter
+	self.cnt = time + self.max_health; // time when this round ends
 	self.classname = "target_assault_roundend";
 	self.use = assault_new_round;
+	self.think = assault_roundend_think;
+	self.nextthink = time;
 }
 
 void assault_roundstart_use() {




More information about the nexuiz-commits mailing list