r5625 - in trunk/data: qcsrc/server scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Jan 22 03:15:22 EST 2009


Author: div0
Date: 2009-01-22 03:15:16 -0500 (Thu, 22 Jan 2009)
New Revision: 5625

Modified:
   trunk/data/qcsrc/server/arena.qc
   trunk/data/qcsrc/server/assault.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/func_breakable.qc
   trunk/data/qcsrc/server/g_triggers.qc
   trunk/data/scripts/entities.def
Log:
new entities: trigger_relay_teamcheck, trigger_disablerelay


Modified: trunk/data/qcsrc/server/arena.qc
===================================================================
--- trunk/data/qcsrc/server/arena.qc	2009-01-22 07:40:44 UTC (rev 5624)
+++ trunk/data/qcsrc/server/arena.qc	2009-01-22 08:15:16 UTC (rev 5625)
@@ -42,6 +42,12 @@
 	for(self = world; (self = nextent(self)); )
 	if(clienttype(self) == CLIENTTYPE_NOTACLIENT)
 	{
+		if(self.team_saved)
+			self.team = self.team_saved;
+
+		if(self.use == SUB_DontUseTargets)
+			self.use = SUB_UseTargets;
+
 		if(self.classname == STR_ITEM_KH_KEY)
 		{
 			kh_Key_AssignTo(self, world);
@@ -106,10 +112,6 @@
 		}
 		// TODO properly reset Assault
 		// General teambased game modes
-		else if(self.classname == "info_player_deathmatch")
-		{
-			self.team = self.team_saved;
-		}
 		else if(self.classname == "func_breakable")
 		{
 			func_breakable_reset();
@@ -141,6 +143,16 @@
 		{
 			self.use();
 		}
+		else if(self.classname == "trigger_gamestart")
+		{
+			if(self.wait)
+			{
+				self.think = self.use;
+				self.nextthink = game_starttime + self.wait;
+			}
+			else
+				self.use();
+		}
 	}
 
 	// Moving the player reset code here since the player-reset depends

Modified: trunk/data/qcsrc/server/assault.qc
===================================================================
--- trunk/data/qcsrc/server/assault.qc	2009-01-22 07:40:44 UTC (rev 5624)
+++ trunk/data/qcsrc/server/assault.qc	2009-01-22 08:15:16 UTC (rev 5625)
@@ -269,30 +269,19 @@
 		assault_attacker_team = COLOR_TEAM1;
 	}
 
-	// swap spawn point teams
+
 	local entity ent;
-	ent = find(world, classname, "info_player_deathmatch");
-	while (ent)
+	for(ent = world; (ent = nextent(ent)); )
 	{
-		if(ent.team_saved == COLOR_TEAM1)
-			ent.team_saved = COLOR_TEAM2;
-		else if(ent.team_saved == COLOR_TEAM2)
-			ent.team_saved = COLOR_TEAM1;
-		ent.team = ent.team_saved;
-		ent = find(ent, classname, "info_player_deathmatch");
+		if(clienttype(ent) == CLIENTTYPE_NOTACLIENT)
+		{
+			if(ent.team_saved == COLOR_TEAM1)
+				ent.team_saved = COLOR_TEAM2;
+			else if(ent.team_saved == COLOR_TEAM2)
+				ent.team_saved = COLOR_TEAM1;
+		}
 	}
 
-	// swap all destructibles
-	ent = find(world, classname, "func_assault_destructible");
-	while (ent)
-	{
-		if(ent.team == COLOR_TEAM1)
-			ent.team = COLOR_TEAM2;
-		else if(ent.team == COLOR_TEAM2)
-			ent.team = COLOR_TEAM1;
-		ent = find(ent, classname, "func_assault_destructible");
-	}
-
 	// reset the level with a countdown
 	cvar_set("timelimit", ftos(ceil(time - game_starttime) / 60));
 	ReadyRestartForce(); // sets game_starttime

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2009-01-22 07:40:44 UTC (rev 5624)
+++ trunk/data/qcsrc/server/defs.qh	2009-01-22 08:15:16 UTC (rev 5625)
@@ -525,3 +525,6 @@
 .string target3;
 .string target4;
 .float trigger_reverse;
+
+void SUB_DontUseTargets();
+void SUB_UseTargets();

Modified: trunk/data/qcsrc/server/func_breakable.qc
===================================================================
--- trunk/data/qcsrc/server/func_breakable.qc	2009-01-22 07:40:44 UTC (rev 5624)
+++ trunk/data/qcsrc/server/func_breakable.qc	2009-01-22 08:15:16 UTC (rev 5625)
@@ -203,5 +203,7 @@
 	if(self.noise)
 		precache_sound(self.noise);
 
+	self.team_saved = self.team;
+
 	func_breakable_reset();
 }

Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc	2009-01-22 07:40:44 UTC (rev 5624)
+++ trunk/data/qcsrc/server/g_triggers.qc	2009-01-22 08:15:16 UTC (rev 5625)
@@ -1,4 +1,8 @@
+void SUB_DontUseTargets()
+{
+}
 
+
 void() SUB_UseTargets;
 
 void DelayThink()
@@ -252,6 +256,8 @@
 
 	EXACTTRIGGER_INIT;
 
+	self.team_saved = self.team;
+
 	if (self.health)
 	{
 		if (self.spawnflags & SPAWNFLAG_NOTOUCH)
@@ -1340,10 +1346,12 @@
 }
 
 void spawnfunc_trigger_gamestart() {
+	self.use = gamestart_use;
+
 	if(self.wait)
 	{
-		self.think = gamestart_use;
-		self.nextthink = self.wait;
+		self.think = self.use;
+		self.nextthink = game_starttime + self.wait;
 	}
 	else
 		InitializeEntity(self, gamestart_use, INITPRIO_FINDTARGET);
@@ -1438,3 +1446,65 @@
 		precache_sound(strcat(self.netname, "/", argv(i), ".wav"));
 	}
 }
+
+
+
+void trigger_relay_teamcheck_use()
+{
+	if(activator.team)
+	{
+		if(self.spawnflags & 2)
+		{
+			if(activator.team != self.team)
+				SUB_UseTargets();
+		}
+		else
+		{
+			if(activator.team == self.team)
+				SUB_UseTargets();
+		}
+	}
+	else
+	{
+		if(self.spawnflags & 1)
+			SUB_UseTargets();
+	}
+}
+
+void spawnfunc_trigger_relay_teamcheck()
+{
+	self.team_saved = self.team;
+	self.use = trigger_relay_teamcheck_use;
+}
+
+
+
+void trigger_disablerelay_use()
+{
+	entity e;
+
+	float a, b;
+	a = b = 0;
+
+	for(e = world; (e = find(e, targetname, self.target)); )
+	{
+		if(e.use == SUB_UseTargets)
+		{
+			e.use = SUB_DontUseTargets;
+			++a;
+		}
+		else if(e.use == SUB_DontUseTargets)
+		{
+			e.use = SUB_UseTargets;
+			++b;
+		}
+	}
+
+	if(!a == !b)
+		print("Invalid use of trigger_disablerelay: ", ftos(a), " relays were on, ", ftos(b), " relays were off!\n");
+}
+
+void spawnfunc_trigger_disablerelay()
+{
+	self.use = trigger_disablerelay_use;
+}

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2009-01-22 07:40:44 UTC (rev 5624)
+++ trunk/data/scripts/entities.def	2009-01-22 08:15:16 UTC (rev 5625)
@@ -897,6 +897,9 @@
 More than one "trigger event" can be delayed at once, as opposed to trigger_delay.
 -------- KEYS --------
 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
@@ -1363,3 +1366,27 @@
 PROJECT_ON_TARGET3NORMAL: target3's origin is projected onto the given direction vector, not on the plane perpendicular to it
 PROJECT_ON_TARGET4NORMAL: target4's origin is projected onto the given direction vector, not on the plane perpendicular to it
 */
+
+/*QUAKED trigger_relay_teamcheck (.5 .5 .5) (-8 -8 -8) (8 8 8) NOTEAM_TOO INVERT
+Works similar to trigger_relay, but only relays trigger events if the team of the activator matches this entity's team
+-------- KEYS --------
+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
+killtarget: remove all entities with this targetname when triggered
+team: 5 for red, 14 for blue, 13 for yellow, 10 for pink team
+-------- SPAWNFLAGS --------
+NOTEAM_TOO: also relay events if the activator has no team set
+INVERT: only relay the event if this entity has the matching team
+*/
+
+/*QUAKED trigger_disablerelay (.5 .5 .5) (-8 -8 -8) (8 8 8) 
+Disables a trigger_relay temporarily (until triggered again)
+-------- KEYS --------
+target: disable/enable all relays with this targetname when triggered
+targetname: name that identifies this entity so it can be triggered
+*/




More information about the nexuiz-commits mailing list