BotLib: add cvar bot_prefix, add method SetName() which respects it.
This commit is contained in:
parent
6bc54d4219
commit
68974053f4
|
@ -89,6 +89,8 @@ class bot:player
|
||||||
virtual void(entity) SetEnemy;
|
virtual void(entity) SetEnemy;
|
||||||
virtual float(void) GetRunSpeed;
|
virtual float(void) GetRunSpeed;
|
||||||
virtual float(void) GetWalkSpeed;
|
virtual float(void) GetWalkSpeed;
|
||||||
|
|
||||||
|
virtual void(string) SetName;
|
||||||
};
|
};
|
||||||
|
|
||||||
entity Bot_AddQuick(void);
|
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
|
void
|
||||||
bot::bot(void)
|
bot::bot(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,11 @@ Bot_PickName(entity target)
|
||||||
if (clienttype(pbot) == CLIENTTYPE_BOT)
|
if (clienttype(pbot) == CLIENTTYPE_BOT)
|
||||||
n++;
|
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");
|
forceinfokey(target, "model", "robo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,3 +20,5 @@ var int autocvar_bot_aimless = FALSE;
|
||||||
|
|
||||||
var int autocvar_nav_linksize = 256;
|
var int autocvar_nav_linksize = 256;
|
||||||
var int autocvar_nav_radius = 8;
|
var int autocvar_nav_radius = 8;
|
||||||
|
|
||||||
|
var string autocvar_bot_prefix = "";
|
||||||
|
|
Loading…
Reference in New Issue