[nexuiz-commits] r7473 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Aug 19 20:38:19 EDT 2009


Author: mand1nga
Date: 2009-08-19 20:38:18 -0400 (Wed, 19 Aug 2009)
New Revision: 7473

Modified:
   trunk/data/qcsrc/server/bots_scripting.qc
Log:
Added command for playing sound files at bot location

Modified: trunk/data/qcsrc/server/bots_scripting.qc
===================================================================
--- trunk/data/qcsrc/server/bots_scripting.qc	2009-08-19 17:53:06 UTC (rev 7472)
+++ trunk/data/qcsrc/server/bots_scripting.qc	2009-08-20 00:38:18 UTC (rev 7473)
@@ -6,7 +6,7 @@
 void bot_clearqueue(entity bot)
 {
 	if(!bot.bot_cmdqueuebuf_allocated)
-		error("readcommand but no queue allocated");
+		error("clearqueue but no queue allocated");
 	buf_del(bot.bot_cmdqueuebuf);
 	bot.bot_cmdqueuebuf_allocated = FALSE;
 	dprint("bot ", bot.netname, " queue cleared\n");
@@ -130,11 +130,12 @@
 #define BOT_CMD_AIMTARGET       19
 #define BOT_CMD_BARRIER         20
 #define BOT_CMD_CONSOLE			21
-#define BOT_CMD_WHILE			22	// TODO: Not implemented yet
-#define BOT_CMD_WEND			23	// TODO: Not implemented yet
-#define BOT_CMD_CHASE			24	// TODO: Not implemented yet
+#define BOT_CMD_SOUND			22
+#define BOT_CMD_WHILE			23	// TODO: Not implemented yet
+#define BOT_CMD_WEND			24	// TODO: Not implemented yet
+#define BOT_CMD_CHASE			25	// TODO: Not implemented yet
 
-#define BOT_CMD_COUNTER			22	// Update this value if you add/remove a command
+#define BOT_CMD_COUNTER			23	// Update this value if you add/remove a command
 
 // NOTE: Following commands should be implemented on the bot ai
 //		 If a new command should be handled by the target ai(s) please declare it here
@@ -237,6 +238,9 @@
 	bot_cmd_string[BOT_CMD_CONSOLE] = "console";
 	bot_cmd_parm_type[BOT_CMD_CONSOLE] = BOT_CMD_PARAMETER_STRING;
 
+	bot_cmd_string[BOT_CMD_SOUND] = "sound";
+	bot_cmd_parm_type[BOT_CMD_SOUND] = BOT_CMD_PARAMETER_STRING;
+
 	bot_cmds_initialized = TRUE;
 }
 
@@ -441,6 +445,9 @@
 			case BOT_CMD_RELEASEKEY:
 				print("Release previoulsy used keys. Use the parameter \"all\" to release all keys");
 				break;
+			case BOT_CMD_SOUND:
+				print("play sound file at bot location");
+				break;
 			default:
 				print("This command has no description yet.");
 				break;
@@ -1040,6 +1047,18 @@
 	return self.cmd_resetgoal();
 }
 
+
+float bot_cmd_sound()
+{
+	string f;
+	f = bot_cmd.bot_cmd_parm_string;
+
+	precache_sound(f);
+	sound(self, CHAN_WEAPON2, f, VOL_BASE, ATTN_MIN);
+
+	return CMD_STATUS_FINISHED;
+}
+
 //
 
 void bot_command_executed(float rm)
@@ -1225,6 +1244,9 @@
 			localcmd(strcat(bot_cmd.bot_cmd_parm_string, "\n"));
 			status = CMD_STATUS_FINISHED;
 			break;
+		case BOT_CMD_SOUND:
+			status = bot_cmd_sound();
+			break;
 		default:
 			print(strcat("ERROR: Invalid command on queue with id '",ftos(bot_cmd.bot_cmd_type),"'\n"));
 			return 0;



More information about the nexuiz-commits mailing list