void bot_clearqueue(entity bot)
{
if(!bot.bot_cmdqueuebuf_allocated)
- error("clearqueue but no queue allocated");
+ return;
buf_del(bot.bot_cmdqueuebuf);
bot.bot_cmdqueuebuf_allocated = FALSE;
dprint("bot ", bot.netname, " queue cleared\n");
{
bot.bot_cmdqueuebuf = buf_create();
bot.bot_cmdqueuebuf_allocated = TRUE;
+ bot.bot_cmdqueuebuf_start = 0;
+ bot.bot_cmdqueuebuf_end = 0;
}
bufstr_set(bot.bot_cmdqueuebuf, bot.bot_cmdqueuebuf_end, cmdstring);
{
parm = substring(cmdstr, sp + 1, -1);
cmdstr = substring(cmdstr, 0, sp);
+ if(cmdstr == "sound")
+ precache_sound(cmdstr);
}
- if(cmdstr == "sound")
- precache_sound(cmdstr);
}
bot.bot_cmdqueuebuf_end += 1;
entity find_bot_by_number(float number)
{
entity bot;
- float c;
+ float c = 0;
if(!number)
return world;
bot_commands_init();
print("List of all available commands:\n");
- print(" Command\t\t\t\tParameter Type\n");
+ print(" Command - Parameter Type\n");
for(i=1;i<BOT_CMD_COUNTER;++i)
{
ptype = "none";
break;
}
- print(strcat(" ",bot_cmd_string[i],"\t\t\t\t<",ptype,"> \n"));
+ print(strcat(" ",bot_cmd_string[i]," - <",ptype,"> \n"));
}
}
if(f)
{
self.colormod = '0 8 8';
- print("Bot wants to fire, inhibited by weaponentity state\n");
+ print("Bot ", self.netname, " using ", self.weaponname, " wants to fire, inhibited by weaponentity state\n");
}
}
else if(ATTACK_FINISHED(self) > time)
if(f)
{
self.colormod = '8 0 8';
- print("Bot wants to fire, inhibited by ATTACK_FINISHED\n");
+ print("Bot ", self.netname, " using ", self.weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(self) - time), " seconds left)\n");
}
}
else if(self.tuba_note)
if(f)
{
self.colormod = '8 0 0';
- print("Bot wants to fire, bot still has an active tuba note\n");
+ print("Bot ", self.netname, " using ", self.weaponname, " wants to fire, bot still has an active tuba note\n");
}
}
else
if(!f)
{
self.colormod = '8 8 0';
- print("Bot thinks it has fired, but apparently did not\n");
+ print("Bot ", self.netname, " using ", self.weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(self) - time), " seconds left\n");
}
}
FOR_EACH_CLIENT(cl) if(cl.isbot)
{
- if(cl.bot_cmdqueuebuf_allocated)
- bot_clearqueue(cl);
+ cl.bot_cmd_execution_index = 0;
+ bot_clearqueue(cl);
// also, cancel all barriers
cl.bot_barrier = 0;
for(i = 0; i < cl.bot_places_count; ++i)