r4306 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Sep 3 04:22:26 EDT 2008


Author: div0
Date: 2008-09-03 04:22:25 -0400 (Wed, 03 Sep 2008)
New Revision: 4306

Modified:
   trunk/data/qcsrc/server/portals.qc
Log:
better track ownership of portals; still to fix: player leaving


Modified: trunk/data/qcsrc/server/portals.qc
===================================================================
--- trunk/data/qcsrc/server/portals.qc	2008-09-03 08:13:39 UTC (rev 4305)
+++ trunk/data/qcsrc/server/portals.qc	2008-09-03 08:22:25 UTC (rev 4306)
@@ -259,6 +259,16 @@
 		SUB_SetFade(self.enemy, time + 1, 1);
 		Portal_Disconnect(self, self.enemy);
 	}
+	if(self.owner.portal_in == self)
+	{
+		self.owner.portal_in = world;
+		print("fixed in-portal ownership\n");
+	}
+	if(self.owner.portal_out == self)
+	{
+		self.owner.portal_out = world;
+		print("fixed out-portal ownership\n");
+	}
 }
 
 void Portal_RequestVanish(entity portal)
@@ -267,7 +277,11 @@
 	oldself = self;
 	self = portal;
 	if(self.enemy)
+	{
 		self.enemy.portal_wants_to_vanish = 1;
+		self.enemy.fade_time = time;
+	}
+	self.fade_time = time;
 	Portal_Think();
 	self = oldself;
 }
@@ -335,7 +349,14 @@
 		
 	own.portal_in = Portal_Spawn(own, trace_endpos + trace_plane_normal, fixedvectoangles2(trace_plane_normal, dir));
 	if(!own.portal_in)
+	{
+		if(own.portal_out)
+		{
+			Portal_RequestVanish(own.portal_out);
+			own.portal_out = world;
+		}
 		return 0;
+	}
 	own.portal_in.portal_id = portal_id_val;
 
 	if(own.portal_out)
@@ -349,7 +370,10 @@
 	if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
 	{
 		if(own.portal_in.portal_id == portal_id_val)
+		{
 			Portal_RequestVanish(own.portal_in);
+			own.portal_in = world;
+		}
 		return 0;
 	}
 
@@ -378,6 +402,7 @@
 	if(!own.portal_out)
 	{
 		Portal_RequestVanish(own.portal_in);
+		own.portal_in = world;
 		return 0;
 	}
 	own.portal_out.portal_id = portal_id_val;




More information about the nexuiz-commits mailing list