}
bufstr_set(bot.bot_cmdqueuebuf, bot.bot_cmdqueuebuf_end, cmdstring);
+
+ // if the command was a "sound" command, precache the sound NOW
+ // this prevents lagging!
+ {
+ float sp;
+ string parm;
+ string cmdstr;
+
+ sp = strstrofs(cmdstr, " ", 0);
+ if(sp < 0)
+ {
+ parm = "";
+ }
+ else
+ {
+ parm = substring(cmdstr, sp + 1, -1);
+ cmdstr = substring(cmdstr, 0, sp);
+ }
+ if(cmdstr == "sound")
+ precache_sound(cmdstr);
+ }
+
bot.bot_cmdqueuebuf_end += 1;
}
#define MAX_BOT_PLACES 4
.float bot_places_count;
-.entity bot_places[MAX_BOT_PLACES]; FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(bot_places);
-.string bot_placenames[MAX_BOT_PLACES]; FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(bot_placenames);
+.entity bot_places[MAX_BOT_PLACES];
+.string bot_placenames[MAX_BOT_PLACES];
entity bot_getplace(string placename)
{
entity e;
f = bot_cmd.bot_cmd_parm_string;
precache_sound(f);
- sound(self, CHAN_WEAPON2, f, VOL_BASE, ATTN_MIN);
+ sound(self, CH_WEAPON_B, f, VOL_BASE, ATTN_MIN);
return CMD_STATUS_FINISHED;
}
{
local float status, ispressingkey;
- if(self.deadflag!=DEAD_NO)
- return 0;
-
// Find command
bot_setcurrentcommand();
+ // if we have no bot command, better return
+ // old logic kept pressing previously pressed keys, but that has problems
+ // (namely, it means you cannot make a bot "normal" ever again)
+ // to keep a bot walking for a while, use the "wait" bot command
+ if(bot_cmd == world)
+ return FALSE;
+
// Ignore all commands except continue when the bot is paused
if(self.bot_exec_status & BOT_EXEC_STATUS_PAUSED)
if(bot_cmd.bot_cmd_type!=BOT_CMD_CONTINUE)
// Keep pressing keys raised by the "presskey" command
ispressingkey = !!bot_presskeys();
- if(bot_cmd==world)
- return ispressingkey;
-
// Handle conditions
if not(bot_cmd.bot_cmd_type==BOT_CMD_FI||bot_cmd.bot_cmd_type==BOT_CMD_ELSE)
if(self.bot_cmd_condition_status & CMD_CONDITION_TRUE && self.bot_cmd_condition_status & CMD_CONDITION_FALSE_BLOCK)