[Bots]: Add requested feature (#665)
This commit is contained in:
parent
2698921382
commit
9f67a4f62d
@ -35,8 +35,8 @@ namespace Components
|
|||||||
Loader::Register(new Exception());
|
Loader::Register(new Exception());
|
||||||
Loader::Register(new Auth());
|
Loader::Register(new Auth());
|
||||||
Loader::Register(new Bans());
|
Loader::Register(new Bans());
|
||||||
Loader::Register(new Bots());
|
|
||||||
Loader::Register(new Dvar());
|
Loader::Register(new Dvar());
|
||||||
|
Loader::Register(new Bots());
|
||||||
Loader::Register(new Lean());
|
Loader::Register(new Lean());
|
||||||
Loader::Register(new Maps());
|
Loader::Register(new Maps());
|
||||||
Loader::Register(new News());
|
Loader::Register(new News());
|
||||||
|
@ -64,8 +64,8 @@ namespace Components
|
|||||||
#include "Modules/Scheduler.hpp"
|
#include "Modules/Scheduler.hpp"
|
||||||
#include "Modules/Auth.hpp"
|
#include "Modules/Auth.hpp"
|
||||||
#include "Modules/Bans.hpp"
|
#include "Modules/Bans.hpp"
|
||||||
#include "Modules/Bots.hpp"
|
|
||||||
#include "Modules/Dvar.hpp"
|
#include "Modules/Dvar.hpp"
|
||||||
|
#include "Modules/Bots.hpp"
|
||||||
#include "Modules/Lean.hpp"
|
#include "Modules/Lean.hpp"
|
||||||
#include "Modules/Maps.hpp"
|
#include "Modules/Maps.hpp"
|
||||||
#include "Modules/News.hpp"
|
#include "Modules/News.hpp"
|
||||||
|
@ -5,6 +5,8 @@ namespace Components
|
|||||||
{
|
{
|
||||||
std::vector<Bots::botData> Bots::BotNames;
|
std::vector<Bots::botData> Bots::BotNames;
|
||||||
|
|
||||||
|
Dvar::Var Bots::SVRandomBotNames;
|
||||||
|
|
||||||
struct BotMovementInfo
|
struct BotMovementInfo
|
||||||
{
|
{
|
||||||
std::int32_t buttons; // Actions
|
std::int32_t buttons; // Actions
|
||||||
@ -57,6 +59,13 @@ namespace Components
|
|||||||
{
|
{
|
||||||
auto data = Utils::String::Split(bots.getBuffer(), '\n');
|
auto data = Utils::String::Split(bots.getBuffer(), '\n');
|
||||||
|
|
||||||
|
if (SVRandomBotNames.get<bool>())
|
||||||
|
{
|
||||||
|
std::random_device rd;
|
||||||
|
std::mt19937 gen(rd());
|
||||||
|
std::ranges::shuffle(data, gen);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& entry : data)
|
for (auto& entry : data)
|
||||||
{
|
{
|
||||||
// Take into account for CR line endings
|
// Take into account for CR line endings
|
||||||
@ -334,6 +343,8 @@ namespace Components
|
|||||||
|
|
||||||
Utils::Hook(0x441B80, G_SelectWeaponIndex_Hk, HOOK_JUMP).install()->quick();
|
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
|
// Reset BotMovementInfo.active when client is dropped
|
||||||
Events::OnClientDisconnect([](const int clientNum)
|
Events::OnClientDisconnect([](const int clientNum)
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,8 @@ namespace Components
|
|||||||
using botData = std::pair< std::string, std::string>;
|
using botData = std::pair< std::string, std::string>;
|
||||||
static std::vector<botData> BotNames;
|
static std::vector<botData> BotNames;
|
||||||
|
|
||||||
|
static Dvar::Var SVRandomBotNames;
|
||||||
|
|
||||||
static int BuildConnectString(char* buffer, const char* connectString, int num, int, int protocol, int checksum, int statVer, int statStuff, int port);
|
static int BuildConnectString(char* buffer, const char* connectString, int num, int, int protocol, int checksum, int statVer, int statStuff, int port);
|
||||||
|
|
||||||
static void Spawn(unsigned int count);
|
static void Spawn(unsigned int count);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user