[Bots]: Add back random bot names dvar (#876)
This commit is contained in:
parent
8284f89777
commit
e539701d3d
@ -12,6 +12,8 @@ namespace Components
|
||||
{
|
||||
std::vector<Bots::botData> Bots::BotNames;
|
||||
|
||||
Dvar::Var Bots::SVRandomBotNames;
|
||||
|
||||
struct BotMovementInfo
|
||||
{
|
||||
std::int32_t buttons; // Actions
|
||||
@ -48,6 +50,13 @@ namespace Components
|
||||
{ "activate", Game::CMD_BUTTON_ACTIVATE },
|
||||
};
|
||||
|
||||
void Bots::RandomizeBotNames()
|
||||
{
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
std::ranges::shuffle(BotNames, gen);
|
||||
}
|
||||
|
||||
void Bots::LoadBotNames()
|
||||
{
|
||||
FileSystem::File bots("bots.txt");
|
||||
@ -87,6 +96,11 @@ namespace Components
|
||||
|
||||
BotNames.emplace_back(entry, clanAbbrev);
|
||||
}
|
||||
|
||||
if (SVRandomBotNames.get<bool>())
|
||||
{
|
||||
RandomizeBotNames();
|
||||
}
|
||||
}
|
||||
|
||||
int Bots::BuildConnectString(char* buffer, const char* connectString, int num, int, int protocol, int checksum, int statVer, int statStuff, int port)
|
||||
@ -351,6 +365,8 @@ namespace Components
|
||||
|
||||
Utils::Hook(0x441B80, G_SelectWeaponIndex_Hk, HOOK_JUMP).install()->quick();
|
||||
|
||||
SVRandomBotNames = Dvar::Register<bool>("sv_RandomBotNames", false, Game::DVAR_NONE, "Randomize the bots' names");
|
||||
|
||||
// Reset BotMovementInfo.active when client is dropped
|
||||
Events::OnClientDisconnect([](const int clientNum)
|
||||
{
|
||||
|
@ -11,6 +11,9 @@ namespace Components
|
||||
using botData = std::pair< std::string, std::string>;
|
||||
static std::vector<botData> BotNames;
|
||||
|
||||
static Dvar::Var SVRandomBotNames;
|
||||
|
||||
static void RandomizeBotNames();
|
||||
static void LoadBotNames();
|
||||
static int BuildConnectString(char* buffer, const char* connectString, int num, int, int protocol, int checksum, int statVer, int statStuff, int port);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user