[nexuiz-commits] r7672 - in trunk/data: . qcsrc/server scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Sep 6 15:12:46 EDT 2009


Author: div0
Date: 2009-09-06 15:12:45 -0400 (Sun, 06 Sep 2009)
New Revision: 7672

Modified:
   trunk/data/Makefile
   trunk/data/qcsrc/server/g_triggers.qc
   trunk/data/scripts/entities.def
Log:
magic ear: decolorize before matching


Modified: trunk/data/Makefile
===================================================================
--- trunk/data/Makefile	2009-09-06 18:59:51 UTC (rev 7671)
+++ trunk/data/Makefile	2009-09-06 19:12:45 UTC (rev 7672)
@@ -21,7 +21,7 @@
 .PHONY: update-cvarcount
 update-cvarcount:
 	[ "$(NEX_BUILDSYSTEM)" = "" ] || [ "$(NEX_BUILDSYSTEM)" = "1" ]
-	[ "$(NEX_BUILDSYSTEM)" != "" ] || { ! [ -f ../misc/netradiant-NexuizPack/nexuiz.game/data/entities.def ] || $(DIFF) ../misc/netradiant-NexuizPack/nexuiz.game/data/entities.def scripts/entities.def || { echo entities.def mismatch, please merge ../misc/netradiant-NexuizPack/nexuiz.game/data/entities.def and scripts/entities.def; exit 1; }; }
+	[ "$(NEX_BUILDSYSTEM)" != "" ] || { ! [ -f ../misc/netradiant-NexuizPack/nexuiz.game/data/entities.def ] || $(DIFF) scripts/entities.def ../misc/netradiant-NexuizPack/nexuiz.game/data/entities.def || { echo entities.def mismatch, please merge ../misc/netradiant-NexuizPack/nexuiz.game/data/entities.def and scripts/entities.def; exit 1; }; }
 	[ "$(NEX_BUILDSYSTEM)" != "" ] || { DO_NOT_RUN_MAKE=1 sh update-cvarcount.sh; }
 
 .PHONY: qc

Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc	2009-09-06 18:59:51 UTC (rev 7671)
+++ trunk/data/qcsrc/server/g_triggers.qc	2009-09-06 19:12:45 UTC (rev 7672)
@@ -1650,7 +1650,7 @@
 string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin)
 {
 	float domatch, dotrigger, matchstart, l;
-	string s;
+	string s, msg;
 	entity oldself;
 
 	magicear_matched = FALSE;
@@ -1681,6 +1681,11 @@
 	matchstart = -1;
 	l = strlen(ear.message);
 
+	if(self.spawnflags & 128)
+		msg = msgin;
+	else
+		msg = strdecolorize(msgin);
+
 	if(substring(ear.message, 0, 1) == "*")
 	{
 		if(substring(ear.message, -1, 1) == "*")
@@ -1689,7 +1694,7 @@
 			// as we need multi-replacement here...
 			s = substring(ear.message, 1, -2);
 			l -= 2;
-			if(strstrofs(msgin, s, 0) >= 0)
+			if(strstrofs(msg, s, 0) >= 0)
 				matchstart = -2; // we use strreplace on s
 		}
 		else
@@ -1697,8 +1702,8 @@
 			// match at start
 			s = substring(ear.message, 1, -1);
 			l -= 1;
-			if(substring(msgin, -l, l) == s)
-				matchstart = strlen(msgin) - l;
+			if(substring(msg, -l, l) == s)
+				matchstart = strlen(msg) - l;
 		}
 	}
 	else
@@ -1708,14 +1713,14 @@
 			// match at end
 			s = substring(ear.message, 0, -2);
 			l -= 1;
-			if(substring(msgin, 0, l) == s)
+			if(substring(msg, 0, l) == s)
 				matchstart = 0;
 		}
 		else
 		{
 			// full match
 			s = ear.message;
-			if(msgin == ear.message)
+			if(msg == ear.message)
 				matchstart = 0;
 		}
 	}
@@ -1740,12 +1745,12 @@
 	else if(ear.netname != "")
 	{
 		if(matchstart < 0)
-			return strreplace(s, ear.netname, msgin);
+			return strreplace(s, ear.netname, msg);
 		else
 			return strcat(
-				substring(msgin, 0, matchstart),
+				substring(msg, 0, matchstart),
 				ear.netname,
-				substring(msgin, matchstart + l, -1)
+				substring(msg, matchstart + l, -1)
 			);
 	}
 	else

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2009-09-06 18:59:51 UTC (rev 7671)
+++ trunk/data/scripts/entities.def	2009-09-06 19:12:45 UTC (rev 7672)
@@ -1719,7 +1719,7 @@
 model="models/items/g_jetpack.md3"
 */
 
-/*QUAKED trigger_magicear (0 0 1) (-8 -8 -8) (8 8 8) IGNORE_SAY IGNORE_TEAMSAY IGNORE_TELL IGNORE_INVALIDTELL REPLACE_WHOLE_MESSAGE REPLACE_OUTSIDE CONTINUE
+/*QUAKED trigger_magicear (0 0 1) (-8 -8 -8) (8 8 8) IGNORE_SAY IGNORE_TEAMSAY IGNORE_TELL IGNORE_INVALIDTELL REPLACE_WHOLE_MESSAGE REPLACE_OUTSIDE CONTINUE NODECOLORIZE
 Triggers targets when a given magic word has been said
 -------- KEYS --------
 message: message to wait for (can start or end with * for wildcards)
@@ -1737,4 +1737,5 @@
 REPLACE_WHOLE_MESSAGE: replace the whole message by netname, or drop the message if netname is empty
 REPLACE_OUTSIDE: also perform the replacement when outside the radius (to hide the "secret word")
 CONTINUE: even if this magic ear matched, continue looking for further matches/replacements (useful for swear word filters)
+NODECOLORIZE: do not decolorize the input string before matching
 */



More information about the nexuiz-commits mailing list