r5372 - in trunk/data: qcsrc/server scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Jan 1 13:37:30 EST 2009


Author: div0
Date: 2009-01-01 13:37:30 -0500 (Thu, 01 Jan 2009)
New Revision: 5372

Modified:
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/t_plats.qc
   trunk/data/scripts/entities.def
Log:
func_door_rotating update by RoKenn


Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2009-01-01 18:34:30 UTC (rev 5371)
+++ trunk/data/qcsrc/server/defs.qh	2009-01-01 18:37:30 UTC (rev 5372)
@@ -510,3 +510,4 @@
 .string target2;
 .string target3;
 .string target4;
+.float trigger_reverse

Modified: trunk/data/qcsrc/server/t_plats.qc
===================================================================
--- trunk/data/qcsrc/server/t_plats.qc	2009-01-01 18:34:30 UTC (rev 5371)
+++ trunk/data/qcsrc/server/t_plats.qc	2009-01-01 18:37:30 UTC (rev 5372)
@@ -106,7 +106,7 @@
 void plat_trigger_use()
 {
 	if (self.think)
-		return;		// allready activated
+		return;		// already activated
 	plat_go_down();
 };
 
@@ -707,7 +707,7 @@
 void door_go_up()
 {
 	if (self.state == STATE_UP)
-		return;		// allready going up
+		return;		// already going up
 
 	if (self.state == STATE_TOP)
 	{	// reset top wait time
@@ -777,7 +777,18 @@
 			door_go_up ();
 		} else 
 		{
-			door_rotating_go_up ();
+			// if the BIDIR spawnflag (==2) is set and the trigger has set trigger_reverse, reverse the opening direction
+			if ((self.spawnflags & 2) && other.trigger_reverse!=0 && self.lip!=666 && self.state == STATE_BOTTOM) 
+			{ 
+				self.lip = 666; // self.lip is used to remember reverse opening direction for door_rotating
+			  	self.pos2 = '0 0 0' - self.pos2; 
+			}
+			// if BIDIR_IN_DOWN (==8) is set, prevent the door from reoping during closing if it is triggered from the wrong side
+			if (!((self.spawnflags & 2) &&  (self.spawnflags & 8) && self.state == STATE_DOWN
+			    && (((self.lip==666) && (other.trigger_reverse==0)) || ((self.lip!=666) && (other.trigger_reverse!=0)))))
+			{
+				door_rotating_go_up ();
+			}
 		}
 		self = self.enemy;
 	} while ( (self != starte) && (self != world) );
@@ -913,6 +924,11 @@
 {
 	if (self.noise1 != "")
 		sound (self, CHAN_TRIGGER, self.noise1, VOL_BASE, ATTN_NORM);
+	if (self.lip==666) // self.lip is used to remember reverse opening direction for door_rotating
+	{ 
+		self.pos2 = '0 0 0' - self.pos2; 
+		self.lip = 0;
+	}
 	self.state = STATE_BOTTOM;
 };
 
@@ -927,7 +943,7 @@
 	}
 
 	self.state = STATE_DOWN;
-	SUB_CalcAngleMove (self.pos1, self.speed, door_hit_bottom);
+	SUB_CalcAngleMove (self.pos1, self.speed, door_rotating_hit_bottom);
 };
 
 void door_rotating_go_up()
@@ -1190,13 +1206,15 @@
 	InitializeEntity(self, LinkDoors, INITPRIO_LINKDOORS);
 };
 
-/*QUAKED spawnfunc_func_door_rotating (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK x x TOGGLE X_AXIS Y_AXIS BIDIR
+/*QUAKED spawnfunc_func_door_rotating (0 .5 .8) ? START_OPEN BIDIR DOOR_DONT_LINK BIDIR_IN_DOWN x TOGGLE X_AXIS Y_AXIS
 if two doors touch, they are assumed to be connected and operate as a unit.
 
 TOGGLE causes the door to wait in both the start and end states for a trigger event.
 
-BIDIR makes the door work bidirectional, so that the opening direction is always away from the requestor. 
-This feature is NOT YET IMPLEMENTED!
+BIDIR makes the door work bidirectional, so that the opening direction is always away from the requestor.
+The usage of bidirectional doors requires two manually instantiated triggers (trigger_multiple), the one to open it in the other direction
+must have set trigger_reverse to 1.
+BIDIR_IN_DOWN will the door prevent from reopening while closing if it is triggered from the other side.
 
 START_OPEN causes the door to move to its destination when spawned, and operate in reverse.  It is used to temporarily or permanently close off an area when triggered (not usefull for touch or takedamage doors).
 
@@ -1271,6 +1289,7 @@
 		self.speed = 50;
 	if (!self.wait)
 		self.wait = 1;
+	self.lip = 0; // self.lip is used to remember reverse opening direction for door_rotating
 
 	self.pos1 = '0 0 0';
 	self.pos2 = self.movedir;

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2009-01-01 18:34:30 UTC (rev 5371)
+++ trunk/data/scripts/entities.def	2009-01-01 18:37:30 UTC (rev 5372)
@@ -90,11 +90,13 @@
 TOGGLE: causes the door to wait in both the start and end states for a trigger event.
 */
 
-/*QUAKED func_door_rotating (0 .5 .8) ? START_OPEN - DOOR_DONT_LINK - - TOGGLE X_AXIS Y_AXIS BIDIR
+/*QUAKED func_door_rotating (0 .5 .8) ? START_OPEN BIDIR DOOR_DONT_LINK BIDIR_IN_DOWN - TOGGLE X_AXIS Y_AXIS
 Normal rotating door entity. By default, the door will activate when player walks close to it or when damage is inflicted to it.
 If DOOR_DONT_LINK is not set, the door will be linked with all doors it touches.
 BIDIR makes the door work bidirectional, so that the opening direction is always away from the requestor.
-This feature is NOT YET IMPLEMENTED!
+The usage of bidirectional doors requires two manually instantiated triggers (trigger_multiple), the one to open it in the other direction
+must have set trigger_reverse to 1.
+BIDIR_IN_DOWN will the door prevent from reopening while closing if it is triggered from the other side.
 -------- KEYS --------
 message: is printed when the door is touched if it is a trigger door and it hasn't been fired yet, or death message if dmg is set
 message2: death message when someone gets pushed into this (default: "was thrown into a world of hurt by"). The # character is replaced by the attacker name if present (and it instead does not get appended to the end)




More information about the nexuiz-commits mailing list