diff --git a/src/botlib/bot.h b/src/botlib/bot.h index 4ea6cd68..096353ae 100644 --- a/src/botlib/bot.h +++ b/src/botlib/bot.h @@ -89,6 +89,8 @@ class bot:player virtual void(entity) SetEnemy; virtual float(void) GetRunSpeed; virtual float(void) GetWalkSpeed; + + virtual void(string) SetName; }; entity Bot_AddQuick(void); diff --git a/src/botlib/bot.qc b/src/botlib/bot.qc index 3d1942d9..da66bc5c 100644 --- a/src/botlib/bot.qc +++ b/src/botlib/bot.qc @@ -520,6 +520,15 @@ bot::PostFrame(void) } } +void +bot::SetName(string nickname) +{ + if (autocvar_bot_prefix) + forceinfokey(this, "name", sprintf("%s %s", autocvar_bot_prefix, nickname)); + else + forceinfokey(this, "name", nickname); +} + void bot::bot(void) { diff --git a/src/botlib/cmd.qc b/src/botlib/cmd.qc index 7d71e8b3..22e0516a 100644 --- a/src/botlib/cmd.qc +++ b/src/botlib/cmd.qc @@ -24,7 +24,11 @@ Bot_PickName(entity target) if (clienttype(pbot) == CLIENTTYPE_BOT) n++; - forceinfokey(target, "name", sprintf("Bot %i", n)); + if (autocvar_bot_prefix) + forceinfokey(target, "name", sprintf("%s Bot %i", autocvar_bot_prefix, n)); + else + forceinfokey(target, "name", sprintf("Bot %i", n)); + forceinfokey(target, "model", "robo"); } diff --git a/src/botlib/cvar.h b/src/botlib/cvar.h index 2b393b83..84967707 100644 --- a/src/botlib/cvar.h +++ b/src/botlib/cvar.h @@ -20,3 +20,5 @@ var int autocvar_bot_aimless = FALSE; var int autocvar_nav_linksize = 256; var int autocvar_nav_radius = 8; + +var string autocvar_bot_prefix = "";