r4071 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Aug 9 08:58:08 EDT 2008


Author: div0
Date: 2008-08-09 08:58:06 -0400 (Sat, 09 Aug 2008)
New Revision: 4071

Modified:
   trunk/data/qcsrc/server/cl_client.qc
Log:
race: support targetting spawnpoints (like Assault). You spawn at a spawnpoint that targets your last checkpoint, if possible.


Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-08-09 12:15:49 UTC (rev 4070)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-08-09 12:58:06 UTC (rev 4071)
@@ -47,10 +47,15 @@
 	if(spot.target != "") {
 		local entity ent;
 		ent = find(world, targetname, spot.target);
+		if(!ent)
+			return -1;
 		while(ent) {
 			if(ent.classname == "target_objective")
 				if(ent.health < 0 || ent.health >= ASSAULT_VALUE_INACTIVE)
 					return -1;
+			else if(ent.classname == "trigger_race_checkpoint")
+				if(self.race_checkpoint != -1 && self.race_checkpoint != ent.cnt)
+					return -1;
 			ent = find(ent, targetname, spot.target);
 		}
 	}
@@ -444,7 +449,8 @@
 	self.viewzoom = 1;
 	self.wantswelcomemessage = 1;
 
-	race_PreparePlayer();
+	if(g_race)
+		race_PreparePlayer();
 
 	if(g_arena)
 	{
@@ -569,6 +575,10 @@
 	if(self.classname == "player") {
 		entity	spot;
 
+		if(g_race)
+			if(self.killcount == -666)
+				race_PreparePlayer();
+
 		spot = SelectSpawnPoint (FALSE);
 		if(!spot)
 		{
@@ -675,6 +685,12 @@
 		self.statdraintime = time + 5;
 		self.BUTTON_ATCK = self.BUTTON_JUMP = self.BUTTON_ATCK2 = 0;
 
+		if(g_race)
+			if(self.killcount != -666)
+				if(spot.target == "")
+					// let the player run without timing, if he did not spawn at a targetting spawnpoint
+					race_PreparePlayer();
+
 		if(self.killcount == -666) {
 			PlayerScore_Clear(self);
 			self.killcount = 0;
@@ -693,8 +709,6 @@
 		self.lms_traveled_distance = 0;
 		self.speedrunning = FALSE;
 
-		race_PreparePlayer();
-
 		if(cvar("spawn_debug"))
 		{
 			sprint(self, strcat("spawnpoint origin:  ", vtos(spot.origin), "\n"));




More information about the nexuiz-commits mailing list