r1887 - branches/nexuiz-2.0/data/qcsrc/server trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Sep 18 21:35:32 EDT 2006


Author: kadaverjack
Date: 2006-09-18 21:35:31 -0400 (Mon, 18 Sep 2006)
New Revision: 1887

Modified:
   branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc
   branches/nexuiz-2.0/data/qcsrc/server/ctf.qc
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/ctf.qc
Log:
changed ctf flag to use setattachment(), so it won't lag anymore when carried


Modified: branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc	2006-09-15 22:33:18 UTC (rev 1886)
+++ branches/nexuiz-2.0/data/qcsrc/server/cl_client.qc	2006-09-19 01:35:31 UTC (rev 1887)
@@ -892,7 +892,10 @@
 
 };
 
-float() ChatBubble_customizeentityforclient = {return (self.owner.team == other.team && other.killcount > -666);};
+float() TeamBubble_customizeentityforclient
+{
+	return (self.owner != other && self.owner.team == other.team && other.killcount > -666);
+}
 
 void() UpdateTeamBubble =
 {
@@ -912,7 +915,7 @@
 		setattachment(self.teambubbleentity, self, "");  // sticks to moving player better, also conserves bandwidth
 		self.teambubbleentity.mdl = self.teambubbleentity.model;
 		self.teambubbleentity.model = self.teambubbleentity.mdl;
-		self.teambubbleentity.customizeentityforclient = ChatBubble_customizeentityforclient;
+		self.teambubbleentity.customizeentityforclient = TeamBubble_customizeentityforclient;
 	}
 }
 

Modified: branches/nexuiz-2.0/data/qcsrc/server/ctf.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/ctf.qc	2006-09-15 22:33:18 UTC (rev 1886)
+++ branches/nexuiz-2.0/data/qcsrc/server/ctf.qc	2006-09-19 01:35:31 UTC (rev 1887)
@@ -8,6 +8,8 @@
 //float FLAGSCORE_CAPTURE       =  5;
 //float FLAGSCORE_CAPTURE_TEAM  = 20;
 
+#define FLAG_CARRY_POS '-15 0 7'
+
 void() FlagThink;
 void() FlagTouch;
 
@@ -18,6 +20,7 @@
 	if(!self.t_length)
 		self.t_length = 119; // maximum frame
 
+	setattachment(self, world, "");	
 	self.mdl = self.model;
 	self.flags = FL_ITEM;
 	self.solid = SOLID_TRIGGER;
@@ -53,6 +56,7 @@
 
 void(entity e) RegenFlag =
 {
+	setattachment(e, world, "");	
 	e.movetype = MOVETYPE_TOSS;
 	e.solid = SOLID_TRIGGER;
 	// TODO: play a sound here
@@ -89,6 +93,8 @@
 	}
 	bprint(strcat(p.netname, "^7 lost the ", e.netname, "\n"));
 
+	setattachment(e, world, "");
+
 	if (p.flagcarried == e)
 		p.flagcarried = world;
 	e.owner = world;
@@ -131,6 +137,7 @@
 
 	if (self.cnt == FLAG_DROPPED)
 	{
+		setattachment(self, world, "");
 		if (time > self.pain_finished)
 		{
 			bprint(strcat("The ", self.netname, " has returned to base\n"));
@@ -148,49 +155,6 @@
 		LogCTF("dropped", self.team, e);
 		return;
 	}
-
-	// borrowed from threewave CTF, because it would be way too much work
-
-	makevectors (e.angles);
-	v = v_forward;
-	v_z = 0 - v_z; // reverse z
-
-	f = 14;
-	/*
-	if (e.frame >= 29 && e.frame <= 40)
-	{
-		if (e.frame >= 29 && e.frame <= 34)
-		{
-			//axpain
-			if      (e.frame == 29) f = f + 2;
-			else if (e.frame == 30) f = f + 8;
-			else if (e.frame == 31) f = f + 12;
-			else if (e.frame == 32) f = f + 11;
-			else if (e.frame == 33) f = f + 10;
-			else if (e.frame == 34) f = f + 4;
-		}
-		else if (e.frame >= 35 && e.frame <= 40)
-		{
-			// pain
-			if      (e.frame == 35) f = f + 2;
-			else if (e.frame == 36) f = f + 10;
-			else if (e.frame == 37) f = f + 10;
-			else if (e.frame == 38) f = f + 8;
-			else if (e.frame == 39) f = f + 4;
-			else if (e.frame == 40) f = f + 2;
-		}
-	}
-	else if (e.frame >= 103 && e.frame <= 118)
-	{
-		if      (e.frame >= 103 && e.frame <= 104) f = f + 6;  //nailattack
-		else if (e.frame >= 105 && e.frame <= 106) f = f + 6;  //light
-		else if (e.frame >= 107 && e.frame <= 112) f = f + 7;  //rocketattack
-		else if (e.frame >= 112 && e.frame <= 118) f = f + 7;  //shotattack
-	}
-	*/
-	self.angles = e.angles + '0 0 -45';
-	setorigin (self, e.origin + '0 0 0' - f*v + v_right * 22);
-	self.nextthink = time + 0.01;
 };
 
 float   flagcaptimerecord;
@@ -278,6 +242,10 @@
 			player = find(player, classname, "player");
 		}
 
+		self.movetype = MOVETYPE_NONE;
+		setorigin(self, FLAG_CARRY_POS);
+		setattachment(self, other, "");
+
 		return;
 	}
 
@@ -314,6 +282,9 @@
 				if(player.team == self.team) centerprint(player, "The enemy got your flag! Retrieve it!");
 				player = find(player, classname, "player");
 			}
+			self.movetype = MOVETYPE_NONE;	// flag must have MOVETYPE_NONE here, otherwise it will drop through the floor...
+			setorigin(self, FLAG_CARRY_POS);
+			setattachment(self, other, "");
 		}
 	}
 };

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2006-09-15 22:33:18 UTC (rev 1886)
+++ trunk/data/qcsrc/server/cl_client.qc	2006-09-19 01:35:31 UTC (rev 1887)
@@ -909,7 +909,10 @@
 
 };
 
-float() ChatBubble_customizeentityforclient = {return (self.owner.team == other.team && other.killcount > -666);};
+float() TeamBubble_customizeentityforclient
+{
+	return (self.owner != other && self.owner.team == other.team && other.killcount > -666);
+}
 
 void() UpdateTeamBubble =
 {
@@ -929,7 +932,7 @@
 		setattachment(self.teambubbleentity, self, "");  // sticks to moving player better, also conserves bandwidth
 		self.teambubbleentity.mdl = self.teambubbleentity.model;
 		self.teambubbleentity.model = self.teambubbleentity.mdl;
-		self.teambubbleentity.customizeentityforclient = ChatBubble_customizeentityforclient;
+		self.teambubbleentity.customizeentityforclient = TeamBubble_customizeentityforclient;
 	}
 }
 

Modified: trunk/data/qcsrc/server/ctf.qc
===================================================================
--- trunk/data/qcsrc/server/ctf.qc	2006-09-15 22:33:18 UTC (rev 1886)
+++ trunk/data/qcsrc/server/ctf.qc	2006-09-19 01:35:31 UTC (rev 1887)
@@ -8,6 +8,8 @@
 //float FLAGSCORE_CAPTURE       =  5;
 //float FLAGSCORE_CAPTURE_TEAM  = 20;
 
+#define FLAG_CARRY_POS '-15 0 7'
+
 void() FlagThink;
 void() FlagTouch;
 
@@ -18,6 +20,7 @@
 	if(!self.t_length)
 		self.t_length = 119; // maximum frame
 
+	setattachment(self, world, "");	
 	self.mdl = self.model;
 	self.flags = FL_ITEM;
 	self.solid = SOLID_TRIGGER;
@@ -53,6 +56,7 @@
 
 void(entity e) RegenFlag =
 {
+	setattachment(e, world, "");	
 	e.movetype = MOVETYPE_TOSS;
 	e.solid = SOLID_TRIGGER;
 	// TODO: play a sound here
@@ -89,6 +93,8 @@
 	}
 	bprint(strcat(p.netname, "^7 lost the ", e.netname, "\n"));
 
+	setattachment(e, world, "");
+
 	if (p.flagcarried == e)
 		p.flagcarried = world;
 	e.owner = world;
@@ -131,6 +137,7 @@
 
 	if (self.cnt == FLAG_DROPPED)
 	{
+		setattachment(self, world, "");
 		if (time > self.pain_finished)
 		{
 			bprint(strcat("The ", self.netname, " has returned to base\n"));
@@ -148,49 +155,6 @@
 		LogCTF("dropped", self.team, e);
 		return;
 	}
-
-	// borrowed from threewave CTF, because it would be way too much work
-
-	makevectors (e.angles);
-	v = v_forward;
-	v_z = 0 - v_z; // reverse z
-
-	f = 14;
-	/*
-	if (e.frame >= 29 && e.frame <= 40)
-	{
-		if (e.frame >= 29 && e.frame <= 34)
-		{
-			//axpain
-			if      (e.frame == 29) f = f + 2;
-			else if (e.frame == 30) f = f + 8;
-			else if (e.frame == 31) f = f + 12;
-			else if (e.frame == 32) f = f + 11;
-			else if (e.frame == 33) f = f + 10;
-			else if (e.frame == 34) f = f + 4;
-		}
-		else if (e.frame >= 35 && e.frame <= 40)
-		{
-			// pain
-			if      (e.frame == 35) f = f + 2;
-			else if (e.frame == 36) f = f + 10;
-			else if (e.frame == 37) f = f + 10;
-			else if (e.frame == 38) f = f + 8;
-			else if (e.frame == 39) f = f + 4;
-			else if (e.frame == 40) f = f + 2;
-		}
-	}
-	else if (e.frame >= 103 && e.frame <= 118)
-	{
-		if      (e.frame >= 103 && e.frame <= 104) f = f + 6;  //nailattack
-		else if (e.frame >= 105 && e.frame <= 106) f = f + 6;  //light
-		else if (e.frame >= 107 && e.frame <= 112) f = f + 7;  //rocketattack
-		else if (e.frame >= 112 && e.frame <= 118) f = f + 7;  //shotattack
-	}
-	*/
-	self.angles = e.angles + '0 0 -45';
-	setorigin (self, e.origin + '0 0 0' - f*v + v_right * 22);
-	self.nextthink = time + 0.01;
 };
 
 float   flagcaptimerecord;
@@ -278,6 +242,10 @@
 			player = find(player, classname, "player");
 		}
 
+		self.movetype = MOVETYPE_NONE;
+		setorigin(self, FLAG_CARRY_POS);
+		setattachment(self, other, "");
+
 		return;
 	}
 
@@ -314,6 +282,9 @@
 				if(player.team == self.team) centermsg_setfor(player, CENTERMSG_CTF, "The enemy got your flag! Retrieve it!");
 				player = find(player, classname, "player");
 			}
+			self.movetype = MOVETYPE_NONE;	// flag must have MOVETYPE_NONE here, otherwise it will drop through the floor...
+			setorigin(self, FLAG_CARRY_POS);
+			setattachment(self, other, "");
 		}
 	}
 };




More information about the nexuiz-commits mailing list