r5034 - in trunk/data: qcsrc/server scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Nov 10 10:52:19 EST 2008


Author: div0
Date: 2008-11-10 10:52:19 -0500 (Mon, 10 Nov 2008)
New Revision: 5034

Modified:
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/g_triggers.qc
   trunk/data/qcsrc/server/target_spawn.qc
   trunk/data/scripts/entities.def
Log:
trgger_multiple: support target, target2, target3, target4
info_player_*: trigger target2, ..., target4 (can't safely trigger target, I suppose)


Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-11-10 14:29:41 UTC (rev 5033)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-11-10 15:52:19 UTC (rev 5034)
@@ -620,7 +620,8 @@
 		self.classname = "observer";
 
 	if(self.classname == "player") {
-		entity	spot;
+		entity spot, oldself;
+		string s;
 
 		race_PreSpawn();
 
@@ -791,6 +792,16 @@
 
 		target_voicescript_clear(self);
 
+		s = spot.target;
+		spot.target = string_null;
+			oldself = self;
+			self = spot;
+				activator = oldself;
+					SUB_UseTargets();
+				activator = world;
+			self = oldself;
+		spot.target = s;
+
 	} else if(self.classname == "observer") {
 		PutObserverInServer ();
 	}

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2008-11-10 14:29:41 UTC (rev 5033)
+++ trunk/data/qcsrc/server/defs.qh	2008-11-10 15:52:19 UTC (rev 5034)
@@ -502,3 +502,7 @@
 
 void target_voicescript_next(entity pl);
 void target_voicescript_clear(entity pl);
+
+.string target2;
+.string target3;
+.string target4;

Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc	2008-11-10 14:29:41 UTC (rev 5033)
+++ trunk/data/qcsrc/server/g_triggers.qc	2008-11-10 15:52:19 UTC (rev 5034)
@@ -30,6 +30,8 @@
 void SUB_UseTargets()
 {
 	local entity t, stemp, otemp, act;
+	string s;
+	float i;
 
 //
 // check for a delay
@@ -65,45 +67,46 @@
 //
 // kill the killtagets
 //
-	if (self.killtarget)
+	s = self.killtarget;
+	if (s != "")
 	{
-		t = world;
-		do
-		{
-			t = find (t, targetname, self.killtarget);
-			if (!t)
-				return;
-			remove (t);
-		} while ( 1 );
+		for(t = world; (t = find(t, targetname, s)); )
+			remove(t);
 	}
 
 //
 // fire targets
 //
-	if (self.target)
+	act = activator;
+	stemp = self;
+	otemp = other;
+
+	for(i = 0; i < 4; ++i)
 	{
-		act = activator;
-		t = world;
-		do
+		switch(i)
 		{
-			t = find (t, targetname, self.target);
-			if (!t)
+			default:
+			case 0: s = self.target; break;
+			case 1: s = self.target2; break;
+			case 2: s = self.target3; break;
+			case 3: s = self.target4; break;
+		}
+		if (s != "")
+		{
+			for(t = world; (t = find(t, targetname, s)); )
+			if(t.use)
 			{
-				return;
+				self = t;
+				other = stemp;
+				activator = act;
+				self.use();
 			}
-			stemp = self;
-			otemp = other;
-			self = t;
-			other = stemp;
-			if (self.use)
-				self.use ();
-			self = stemp;
-			other = otemp;
-			activator = act;
-		} while ( 1 );
+		}
 	}
 
-
+	activator = act;
+	self = stemp;
+	other = otemp;
 };
 
 

Modified: trunk/data/qcsrc/server/target_spawn.qc
===================================================================
--- trunk/data/qcsrc/server/target_spawn.qc	2008-11-10 14:29:41 UTC (rev 5033)
+++ trunk/data/qcsrc/server/target_spawn.qc	2008-11-10 15:52:19 UTC (rev 5034)
@@ -294,8 +294,6 @@
 void trigger_relay_if_use()
 {
 	float n;
-	var .string fld;
-	entity e;
 	n = self.count;
 
 	// TODO make this generic AND faster than nextent()ing through all, if somehow possible

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2008-11-10 14:29:41 UTC (rev 5033)
+++ trunk/data/scripts/entities.def	2008-11-10 15:52:19 UTC (rev 5034)
@@ -221,6 +221,7 @@
 Attacking team's player spawning location in Assault. Should touch the floor, but not the walls, and should point where the player should look when he spawns there.
 -------- KEYS --------
 target: this should point to a target_objective to decide when this spawning point is active.
+target2: trigger all entities with this targetname when someone spawns
 cnt: weight of spawn point for random selection. Set to a lower value if you have many spawn points close together. Default value is 1.
 */
 
@@ -228,6 +229,7 @@
 Normal player spawning location in game types without team spawns. Should touch the floor, but not the walls, and should point where the player should look when he spawns there.
 -------- KEYS --------
 cnt: weight of spawn point for random selection. Set to a lower value if you have many spawn points close together. Default value is 1.
+target2: trigger all entities with this targetname when someone spawns
 targetname: when targeted by a func_button, pressing the button will assign the spawn point to the team of the activator as an additional spawn point, or reassign it if it was already assigned. Also used to assign spawn points to Onslaught control points.
 */
 
@@ -235,6 +237,7 @@
 Defending team's player spawning location in Assault. Should touch the floor, but not the walls, and should point where the player should look when he spawns there.
 -------- KEYS --------
 target: this should point to a target_objective to decide when this spawning point is active.
+target2: trigger all entities with this targetname when someone spawns
 cnt: weight of spawn point for random selection. Set to a lower value if you have many spawn points close together. Default value is 1.
 */
 
@@ -242,6 +245,7 @@
 Red team's player spawning location in e.g. CTF and Onslaught. Should touch the floor, but not the walls, and should point where the player should look when he spawns there.
 -------- KEYS --------
 cnt: weight of spawn point for random selection. Set to a lower value if you have many spawn points close together. Default value is 1.
+target2: trigger all entities with this targetname when someone spawns
 targetname: when targeted by a func_button, pressing the button will reassign the spawn point to the team of the activator. If a team has no more spawn point left, it immediately loses.
 */
 
@@ -249,6 +253,7 @@
 Blue team's player spawning location in e.g. CTF and Onslaught. Should touch the floor, but not the walls, and should point where the player should look when he spawns there.
 -------- KEYS --------
 cnt: weight of spawn point for random selection. Set to a lower value if you have many spawn points close together. Default value is 1.
+target2: trigger all entities with this targetname when someone spawns
 targetname: when targeted by a func_button, pressing the button will reassign the spawn point to the team of the activator. If a team has no more spawn point left, it immediately loses.
 */
 
@@ -256,6 +261,7 @@
 Yellow team's player spawning location, but there is no game mode to use this yet. Anyway, should touch the floor, but not the walls, and should point where the player should look when he spawns there.
 -------- KEYS --------
 cnt: weight of spawn point for random selection. Set to a lower value if you have many spawn points close together. Default value is 1.
+target2: trigger all entities with this targetname when someone spawns
 targetname: when targeted by a func_button, pressing the button will reassign the spawn point to the team of the activator. If a team has no more spawn point left, it immediately loses.
 */
 
@@ -263,6 +269,7 @@
 Pink team's player spawning location, but there is no game mode to use this yet. Anyway, should touch the floor, but not the walls, and should point where the player should look when he spawns there.
 -------- KEYS --------
 cnt: weight of spawn point for random selection. Set to a lower value if you have many spawn points close together. Default value is 1.
+target2: trigger all entities with this targetname when someone spawns
 targetname: when targeted by a func_button, pressing the button will reassign the spawn point to the team of the activator. If a team has no more spawn point left, it immediately loses.
 */
 
@@ -782,6 +789,9 @@
 sounds: 1 to play misc/secret.wav, 2 to play misc/talk.wav, 3 to play misc/trigger1.wav
 noise: path to sound file, if you want to play something else
 target: trigger all entities with this targetname when triggered
+target2: trigger all entities with this targetname when triggered
+target3: trigger all entities with this targetname when triggered
+target4: trigger all entities with this targetname when triggered
 targetname: name that identifies this entity so it can be triggered
 delay: delay the triggering by the given time
 message: print this message to the player who activated the trigger
@@ -991,6 +1001,7 @@
 NOTE for race_place: when the race starts after the qualifying, the player with the fastest map ends up at the info_player_race with race_place 1, and so on. If there are too many players, or if someone comes in later, he will spawn at an info_player_race with race_place not set. So for each trigger_race_checkpoint, there must be at least one corresponding info_player_race with race_place NOT set.
 -------- KEYS --------
 target: this should point to a trigger_race_checkpoint to decide when this spawning point is active. The checkpoint has to be AFTER this spawn.
+target2: trigger all entities with this targetname when someone spawns
 cnt: weight of spawn point for random selection. Set to a lower value if you have many spawn points close together. Default value is 1.
 race_place: if target points to the trigger_race_checkpoint with cnt 0 (finish line), this sets which place the spawn corresponds to; the special value 0 stands for spawns for players who come in later (have to be behind the ones with race_place set to an actual place), and -1 marks the spawnpoint for qualifying mode only
 */




More information about the nexuiz-commits mailing list