r4828 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Oct 23 05:19:13 EDT 2008


Author: div0
Date: 2008-10-23 05:18:57 -0400 (Thu, 23 Oct 2008)
New Revision: 4828

Modified:
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/mode_onslaught.qc
Log:
fix handling of isolated CPs


Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-10-23 08:47:24 UTC (rev 4827)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-10-23 09:18:57 UTC (rev 4828)
@@ -33,7 +33,6 @@
 // Returns:
 //   -1 if a spawn can't be used
 //   otherwise, a weight of the spawnpoint
-.float islinked; // onslaught
 float Spawn_Score(entity spot, entity playerlist, float teamcheck)
 {
 	float shortest, thisdist;
@@ -60,12 +59,6 @@
 					return -1;
 				good = 1;
 			}
-			else if(ent.classname == "onslaught_controlpoint")
-			{
-				if(!ent.islinked)
-					return -1;
-				good = 1;
-			}
 			else if(ent.classname == "trigger_race_checkpoint")
 			{
 				if(self.classname == "player") // spectators may spawn everywhere

Modified: trunk/data/qcsrc/server/mode_onslaught.qc
===================================================================
--- trunk/data/qcsrc/server/mode_onslaught.qc	2008-10-23 08:47:24 UTC (rev 4827)
+++ trunk/data/qcsrc/server/mode_onslaught.qc	2008-10-23 09:18:57 UTC (rev 4828)
@@ -634,6 +634,7 @@
 	self.nextthink = time + 0.2;
 }
 
+.float waslinked;
 void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
 {
 	entity oself;
@@ -680,16 +681,19 @@
 		// Use targets now (somebody make sure this is in the right place..)
 		oself = self;
 		self = self.owner;
-		activator = self.owner;
+		activator = self;
 		SUB_UseTargets ();
 		self = oself;
 
+		self.owner.waslinked = self.owner.islinked;
+
 		remove(self);
 	}
 };
 
 void onslaught_controlpoint_icon_think()
 {
+	entity oself;
 	self.nextthink = time + 0.1;
 	if (time > self.pain_finished + 1)
 	{
@@ -700,14 +704,41 @@
 	self.alpha = self.health / self.max_health;
 	// colormod flash when shot
 	self.colormod = '1 1 1' * (2 - bound(0, (self.pain_finished - time) / 10, 1));
+
+	if(self.owner.islinked != self.owner.waslinked)
+	{
+		// unteam the spawnpoint if needed
+		float t;
+		t = self.owner.team;
+		if(!self.owner.islinked)
+			self.owner.team = 0;
+
+		oself = self;
+		self = self.owner;
+		activator = self;
+		SUB_UseTargets ();
+		self = oself;
+
+		self.owner.team = t;
+
+		self.owner.waslinked = self.owner.islinked;
+	}
 };
 
 void onslaught_controlpoint_icon_buildthink()
 {
 	local entity oself;
+	float a;
 
 	self.nextthink = time + 0.1;
+
+	// only do this if there is power
+	a = onslaught_controlpoint_can_be_linked(self.owner, self.owner.team);
+	if(!a)
+		return;
+
 	self.health = self.health + self.count;
+
 	if (self.health >= self.max_health)
 	{
 		self.health = self.max_health;




More information about the nexuiz-commits mailing list