r4243 - in trunk/data: qcsrc/server scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Aug 29 13:31:34 EDT 2008


Author: div0
Date: 2008-08-29 13:31:34 -0400 (Fri, 29 Aug 2008)
New Revision: 4243

Modified:
   trunk/data/qcsrc/server/g_triggers.qc
   trunk/data/scripts/entities.def
Log:
laser: also support detectors


Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc	2008-08-29 17:11:52 UTC (rev 4242)
+++ trunk/data/qcsrc/server/g_triggers.qc	2008-08-29 17:31:34 UTC (rev 4243)
@@ -751,9 +751,11 @@
 		self.enemy = find(world, targetname, self.target);
 }
 
+.entity pusher;
 void misc_laser_think()
 {
 	vector o;
+	entity oldself;
 
 	self.nextthink = time;
 
@@ -781,6 +783,38 @@
 		else
 			FireRailgunBullet(self.origin, o, self.dmg * frametime, 0, DEATH_HURTTRIGGER);
 	}
+
+	if(self.enemy.target != "") // DETECTOR laser
+	{
+		traceline(self.origin, o, MOVE_NORMAL, self);
+		if(trace_ent.classname == "player")
+		{
+			self.pusher = trace_ent;
+			if(!self.count)
+			{
+				self.count = 1;
+
+				oldself = self;
+				self = self.enemy;
+				activator = self.pusher;
+				SUB_UseTargets();
+				self = oldself;
+			}
+		}
+		else
+		{
+			if(self.count)
+			{
+				self.count = 0;
+
+				oldself = self;
+				self = self.enemy;
+				activator = self.pusher;
+				SUB_UseTargets();
+				self = oldself;
+			}
+		}
+	}
 }
 
 float laser_SendEntity(entity to, float fl)

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2008-08-29 17:11:52 UTC (rev 4242)
+++ trunk/data/scripts/entities.def	2008-08-29 17:31:34 UTC (rev 4243)
@@ -499,7 +499,7 @@
 /*QUAKED misc_laser (.5 .5 .5) (-8 -8 -8) (8 8 8) START_ON FINITE
 Laser beam emitter
 -------- KEYS --------
-target: target_position the laser targets (may be another entity, the laser will then target its origin. Use origin brushes, that is!)
+target: target_position the laser targets (may be another entity, preferably target_position, possibly controlled by misc_follow)
 mdl: name of particle effect for the beam end point (see effectinfo.txt; default is misc_laser_beam_end)
 colormod: color of the laser beam (default: red, that is, 1 0 0)
 dmg: damage inflicted by the beam per second, or -1 for an instant-death ray
@@ -509,7 +509,8 @@
 START_ON: when targeted, the laser will start switched on
 FINITE: the laser does not extend over its target like light would do, but stops there (takes more bandwidth)
 -------- NOTES --------
-Use trigger_monoflop if you want the laser to turn off for a while, then turn back on
+Use trigger_monoflop if you want the laser to turn off for a while, then turn back on.
+When the laser's target has itself target set, its targets are triggered when someone enters or leaves the laser.
 */
 
 /*QUAKED misc_model (1 .5 .25) (-16 -16 -16) (16 16 16) - SOLID - EXTRUDE_NORMALS EXTRUDE_TERRAIN




More information about the nexuiz-commits mailing list