r2153 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Feb 3 07:46:17 EST 2007


Author: lordhavoc
Date: 2007-02-03 07:46:17 -0500 (Sat, 03 Feb 2007)
New Revision: 2153

Modified:
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/runematch.qc
   trunk/data/qcsrc/server/t_items.qc
Log:
changed runespawner placement to use droptofloor
changed item spawning to use droptofloor and reenabled MOVETYPE_TOSS by
default (noalign still uses MOVETYPE_NONE) so items can ride moving
platforms (as they could originally in nexuiz)
rewrote player spawn point code to not attempt to fix a broken spawn
point and instead do an objerror (which removes it and prints a
message), and it no longer drops the spawn point to the floor
implemented support for DP_SV_PRINT extension if present


Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2007-01-29 23:31:14 UTC (rev 2152)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2007-02-03 12:46:17 UTC (rev 2153)
@@ -16,22 +16,27 @@
 void(string s, float check_dangerous) ServerConsoleEcho =
 {
 	local string ch;
-	localcmd("echo \"");
-	if(check_dangerous)
+	if (checkextension("DP_SV_PRINT"))
+		print(s);
+	else
 	{
-		while(strlen(s))
+		localcmd("echo \"");
+		if(check_dangerous)
 		{
-			ch = substring(s, 0, 1);
-			if(ch != "\"" && ch != "\r" && ch != "\n")
-				localcmd(ch);
-			s = substring(s, 1, strlen(s) - 1);
+			while(strlen(s))
+			{
+				ch = substring(s, 0, 1);
+				if(ch != "\"" && ch != "\r" && ch != "\n")
+					localcmd(ch);
+				s = substring(s, 1, strlen(s) - 1);
+			}
 		}
+		else
+		{
+			localcmd(s);
+		}
+		localcmd("\"\n");
 	}
-	else
-	{
-		localcmd(s);
-	}
-	localcmd("\"\n");
 }
 
 void(string s, float check_dangerous) GameLogEcho =
@@ -81,82 +86,17 @@
 	return a - (floor(a / b) * b);
 }
 
-vector find_floor(vector org)
-{
-	traceline(org + '0 0 5', org - '0 0 255', TRUE, self);
-	if (trace_fraction < 1)
-		return trace_endpos;
-	else
-		return org;
-}
-
 void relocate_spawnpoint()
 {
-	vector org, loc;
-	string error_msg;
+	// nudge off the floor
+	setorigin(self, self.origin + '0 0 1');
 
-	error_msg = "spawn point too close to a wall";
-
-	org = find_floor(self.origin) + '0 0 30';
-
-	traceline(org, org - '18 0 0', TRUE, world);
-	if(trace_fraction < 1)
+	tracebox(self.origin, PL_MIN, PL_MAXS, self.origin, TRUE, self);
+	if (trace_startsolid)
 	{
-		loc = trace_endpos;
-		traceline(loc, loc + '36 0 0', TRUE, world);
-		if(trace_fraction >= 1 && !self.noalign)
-			org = loc + '18 0 0';
-		else
-		{
-			objerror(error_msg);
-			return;
-		}
+		objerror("player spawn point in solid, mapper sucks!\n");
+		return;
 	}
-
-	traceline (org, org - '-18 0 0', TRUE, world);
-	if (trace_fraction < 1)
-	{
-		loc = trace_endpos;
-		traceline (loc, loc + '-36 0 0', TRUE, world);
-		if(trace_fraction >= 1 && !self.noalign)
-			org = loc + '-18 0 0';
-		else
-		{
-			objerror(error_msg);
-			return;
-		}
-	}
-
-	traceline (org, org - '0 18 0' , TRUE, world);
-	if (trace_fraction < 1)
-	{
-		loc = trace_endpos;
-		traceline (loc, loc + '0 36 0', TRUE, world);
-		if(trace_fraction >= 1 && !self.noalign)
-			org = loc + '0 18 0';
-		else
-		{
-			objerror(error_msg);
-			return;
-		}
-	}
-
-	traceline (org, org - '0 -18 0', TRUE, world);
-	if (trace_fraction < 1)
-	{
-		loc = trace_endpos;
-		traceline (loc, loc + '0 -36 0', TRUE, world);
-		if(trace_fraction >= 1 && !self.noalign)
-			org = loc + '0 -18 0';
-		else
-		{
-			objerror(error_msg);
-			return;
-		}
-	}
-
-	if(!self.noalign)
-		setorigin(self, org);
 }
 
 // NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
@@ -459,7 +399,7 @@
 
 	if(p.frags == -666)
 		return;
-	
+
 	f = ceil(factor * p.frags);
 	p.frags = p.frags - f;
 

Modified: trunk/data/qcsrc/server/runematch.qc
===================================================================
--- trunk/data/qcsrc/server/runematch.qc	2007-01-29 23:31:14 UTC (rev 2152)
+++ trunk/data/qcsrc/server/runematch.qc	2007-02-03 12:46:17 UTC (rev 2153)
@@ -39,7 +39,8 @@
 		return;
 	}
 
-	setorigin(self, find_floor(self.origin) + '0 0 35');
+	droptofloor(self);
+	setorigin(self, self.origin + '0 0 35');
 }
 
 string RuneName(float r)

Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc	2007-01-29 23:31:14 UTC (rev 2152)
+++ trunk/data/qcsrc/server/t_items.qc	2007-02-03 12:46:17 UTC (rev 2153)
@@ -227,37 +227,19 @@
 .float is_item;
 void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, string itemname, float itemid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue)
 {
-	vector org;
-	org = self.origin;
-
 	startitem_failed = FALSE;
 
-	if (self.classname != "droppedweapon" && !self.noalign)
+	if (self.classname != "droppedweapon")
 	{
-		vector z_offset;
+		if (!self.noalign)
+		{
+			// first nudge it off the floor a little bit to avoid math errors
+			setorigin(self, self.origin + '0 0 1');
+			// note droptofloor returns FALSE if stuck/or would fall too far
+			droptofloor(self);
+		}
 
-		z_offset = '0 0 1';
-
-		if (itemid == IT_SHELLS)
-			z_offset = '0 0 4';
-		else if (itemid == IT_ROCKETS)
-			z_offset = '0 0 4';
-		else if (itemid == IT_NAILS)
-			z_offset = '0 0 0';
-		else if (itemid == IT_25HP)
-			z_offset = '0 0 5';
-		else if (itemid == IT_ARMOR)
-			z_offset = '0 0 3';
-		else if (itemid == IT_SHOTGUN)
-			z_offset = '0 0 10';
-
-		org = find_floor(org) + z_offset;
-		setorigin(self, org);
-	}
-
-	if(cvar("spawn_debug") >= 2)
-	{
-		if(self.classname != "droppedweapon")
+		if(cvar("spawn_debug") >= 2)
 		{
 			entity otheritem;
 			for(otheritem = findradius(org, 3); otheritem; otheritem = otheritem.chain)
@@ -271,10 +253,9 @@
 			}
 			self.is_item = TRUE;
 		}
-	}
 
-	if (self.classname != "droppedweapon")
 		waypoint_spawnforitem(self);
+	}
 
 	if (!(cvar("g_pickup_items") && !cvar("g_nixnex")) && !cvar("g_minstagib") &&
 			itemid != IT_STRENGTH && itemid != IT_INVINCIBLE && itemid != IT_HEALTH)
@@ -340,6 +321,12 @@
 	self.netname = itemname;
 	self.items = itemid;
 	self.flags = FL_ITEM | itemflags;
+	if (self.noalign)
+		self.movetype = MOVETYPE_NONE;
+	else
+		self.movetype = MOVETYPE_TOSS;
+	self.solid = SOLID_TRIGGER;
+	self.touch = Item_Touch;
 	setmodel (self, self.mdl);
 	if (itemflags & FL_WEAPON)
 	{
@@ -354,9 +341,6 @@
 		setorigin (self, self.origin + '0 0 25');
 	//	setsize (self, '-8 -8 -5', '8 8 8');
 	}
-	self.movetype = MOVETYPE_TOSS;
-	self.solid = SOLID_TRIGGER;
-	self.touch = Item_Touch;
 
 	// Savage: remove thrown items after a certain period of time ("garbage collection")
 	if (self.classname == "droppedweapon")
@@ -364,11 +348,6 @@
 		self.think = RemoveItem;
 		self.nextthink = time + 60;
 	}
-	else
-	{
-		self.movetype = MOVETYPE_NONE;
-		setorigin(self, org);
-	}
 
 	if (cvar("g_fullbrightitems"))
 		self.effects = self.effects | EF_FULLBRIGHT;




More information about the nexuiz-commits mailing list