BotLib: add cvar bot_prefix, add method SetName() which respects it.
This commit is contained in:
parent
6bc54d4219
commit
68974053f4
4 changed files with 18 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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 = "";
|
||||
|
|
Loading…
Reference in a new issue