Add spawnBot command

This fixes issue #69
This commit is contained in:
Maurice Heumann 2022-12-31 12:18:09 +01:00
parent 967e11bcd0
commit f4a4a95674
2 changed files with 31 additions and 1 deletions

View File

@ -1,6 +1,8 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "command.hpp"
#include <utils/nt.hpp>
#include <utils/hook.hpp>
@ -46,6 +48,30 @@ namespace bots
{
utils::hook::jump(0x141653B70_g, get_bot_name);
utils::hook::jump(0x141654280_g, get_bot_name);
command::add("spawnBot", [](const command::params& params)
{
size_t count = 1;
if (params.size() > 1)
{
if (params[1] == "all"s)
{
count = 18;
}
else
{
count = atoi(params[1]);
}
}
for (size_t i = 0; i < count; ++i)
{
if (!game::SV_AddTestClient())
{
break;
}
}
});
}
};
}

View File

@ -25,7 +25,8 @@ namespace game
WEAK symbol<void(const char* cmdName, xcommand_t function, cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{
0x1420ED530
};
WEAK symbol<void(uint32_t localClientNum, ControllerIndex_t controllerIndex, const char* text, bool fromRemoteConsol)> Cmd_ExecuteSingleCommand{
WEAK symbol<void(uint32_t localClientNum, ControllerIndex_t controllerIndex, const char* text,
bool fromRemoteConsol)> Cmd_ExecuteSingleCommand{
0x1420EDC20
};
WEAK symbol<void(char* text, int maxSize)> Con_GetTextCopy{0x14133A7D0};
@ -67,6 +68,9 @@ namespace game
0x141CD98D0
};
// Rendering
WEAK symbol<void*()> SV_AddTestClient{0x1422499A0};
// Variables
WEAK symbol<cmd_function_s> cmd_functions{0x15689FF58};