r4883 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Oct 26 09:07:52 EDT 2008


Author: div0
Date: 2008-10-26 09:07:49 -0400 (Sun, 26 Oct 2008)
New Revision: 4883

Modified:
   trunk/data/qcsrc/server/portals.qc
Log:
try player workaround on hook too


Modified: trunk/data/qcsrc/server/portals.qc
===================================================================
--- trunk/data/qcsrc/server/portals.qc	2008-10-26 12:41:40 UTC (rev 4882)
+++ trunk/data/qcsrc/server/portals.qc	2008-10-26 13:07:49 UTC (rev 4883)
@@ -253,7 +253,13 @@
 	// portal is being removed?
 	if(self.solid != SOLID_TRIGGER)
 		return; // possibly engine bug
+
+	if(other.classname == "player")
+		return; // handled by think
 	
+	if(other.classname == "grapplinghook")
+		return; // handled by think
+	
 	if(!self.enemy)
 		error("Portal_Touch called for a broken portal\n");
 
@@ -440,6 +446,18 @@
 		Portal_Remove(self, 1);
 }
 
+void Portal_Think_TryTeleportPlayer(entity e, vector g)
+{
+	if(!Portal_WillHitPlane(e.origin, e.mins, e.maxs, e.velocity + g, self.origin, v_forward, self.maxs_x))
+		return;
+
+	// if e would hit the portal in a frame...
+	// already teleport him
+	tracebox(e.origin, e.mins, e.maxs, e.origin + e.velocity * 2 * frametime, MOVE_NORMAL, e);
+	if(trace_ent == self)
+		Portal_TeleportPlayer(self, e);
+}
+
 void Portal_Think()
 {
 	entity e, o;
@@ -462,20 +480,15 @@
 
 	FOR_EACH_PLAYER(e)
 	{
-		if(time < self.portal_activatetime)
-			if(e == o)
-				continue;
 		if(e != o)
 			if(IS_INDEPENDENT_PLAYER(e) || IS_INDEPENDENT_PLAYER(o))
 				continue; // cannot go through someone else's portal
-		if(!Portal_WillHitPlane(e.origin, e.mins, e.maxs, e.velocity + g, self.origin, v_forward, self.maxs_x))
-			continue;
 
-		// if e would hit the portal in a frame...
-		// already teleport him
-		tracebox(e.origin, e.mins, e.maxs, e.origin + e.velocity * 2 * frametime, MOVE_NORMAL, e);
-		if(trace_ent == self)
-			Portal_TeleportPlayer(self, e);
+		if(e != o || time >= self.portal_activatetime)
+			Portal_Think_TryTeleportPlayer(e, g);
+
+		if(e.hook)
+			Portal_Think_TryTeleportPlayer(e.hook, g);
 	}
 	self.solid = SOLID_TRIGGER;
 	self.owner = o;




More information about the nexuiz-commits mailing list