Catbot and NavBot improvements
This commit is contained in:
parent
f07598d48d
commit
fdcfecb4ff
@ -29,9 +29,9 @@
|
||||
<AutoVariable width="fill" target="misc.pathing.draw" label="Draw Path"/>
|
||||
<AutoVariable width="fill" target="misc.pathing.look-at-path" label="Look at Path"/>
|
||||
<AutoVariable width="fill" target="navbot.enabled" label="Enable Navbot"/>
|
||||
<!--AutoVariable width="fill" target="navbot.scout-mode" label="Enable Scout Mode"/>
|
||||
<AutoVariable width="fill" target="navbot.spy-mode" label="Enable Spy Mode"/-->
|
||||
<!--AutoVariable width="fill" target="navbot.scout-mode" label="Enable Scout Mode"/-->
|
||||
<AutoVariable width="fill" target="navbot.get-health-and-ammo" label="Get Health and Ammo"/>
|
||||
<AutoVariable width="fill" target="navbot.spy-mode" label="Enable Spy Mode"/>
|
||||
<AutoVariable width="fill" target="navbot.other-mode" label="General Mode"/>
|
||||
<AutoVariable width="fill" target="navbot.primary-only" label="Best Weapon only"/>
|
||||
<AutoVariable width="fill" target="navbot.autojump.enabled" label="Enable Autojump"/>
|
||||
|
@ -108,7 +108,7 @@ void do_random_votekick()
|
||||
return;
|
||||
hack::ExecuteCommand("callvote kick \"" + std::to_string(target) + " cheating\"");
|
||||
}
|
||||
|
||||
static const std::string catbot_names[] = { "K4T-B0T", "cat-bot", "btarrant", "cat-scout", "just disable vac tf", "raul.garcia", "zCat", "lagger bot" };
|
||||
void update_catbot_list()
|
||||
{
|
||||
for (int i = 1; i < g_GlobalVars->maxClients; ++i)
|
||||
@ -118,14 +118,16 @@ void update_catbot_list()
|
||||
continue;
|
||||
|
||||
info.name[31] = 0;
|
||||
if (strcasestr(info.name, "cat-bot") || strcasestr(info.name, "just disable vac tf") || strcasestr(info.name, "raul.garcia") || strcasestr(info.name, "zCat") || strcasestr(info.name, "lagger bot") || strcasestr(info.name, "zLag-bot") || strcasestr(info.name, "crash-bot") || strcasestr(info.name, "reichstagbot"))
|
||||
{
|
||||
if (human_detecting_map.find(info.friendsID) == human_detecting_map.end())
|
||||
std::string pl_name(info.name);
|
||||
for (auto name : catbot_names)
|
||||
if (pl_name.find(name) != pl_name.npos)
|
||||
{
|
||||
logging::Info("Found bot %s [U:1:%u]", info.name, info.friendsID);
|
||||
human_detecting_map.insert(std::make_pair(info.friendsID, catbot_user_state{ 0 }));
|
||||
if (human_detecting_map.find(info.friendsID) == human_detecting_map.end())
|
||||
{
|
||||
logging::Info("Found bot %s [U:1:%u]", info.name, info.friendsID);
|
||||
human_detecting_map.insert(std::make_pair(info.friendsID, catbot_user_state{ 0 }));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,7 +335,7 @@ static void cm()
|
||||
|
||||
//
|
||||
static const int classes[3]{ tf_spy, tf_sniper, tf_pyro };
|
||||
if (*auto_disguise && g_pPlayerResource->GetClass(LOCAL_E) == tf_spy && !HasCondition<TFCond_Disguised>(LOCAL_E) && disguise.test_and_set(3000))
|
||||
if (*auto_disguise && g_pPlayerResource->GetClass(LOCAL_E) == tf_spy && !IsPlayerDisguised(LOCAL_E) && disguise.test_and_set(3000))
|
||||
{
|
||||
int teamtodisguise = (LOCAL_E->m_iTeam() == TEAM_RED) ? TEAM_RED - 1 : TEAM_BLU - 1;
|
||||
int classtojoin = classes[rand() % 3];
|
||||
|
@ -11,6 +11,7 @@ namespace hacks::tf2::NavBot
|
||||
static settings::Bool enabled("navbot.enabled", "false");
|
||||
static settings::Bool stay_near("navbot.stay-near", "true");
|
||||
static settings::Bool heavy_mode("navbot.other-mode", "false");
|
||||
static settings::Bool spy_mode("navbot.spy-mode", "false");
|
||||
static settings::Bool get_health("navbot.get-health-and-ammo", "true");
|
||||
static settings::Float jump_distance("navbot.autojump.trigger-distance", "300");
|
||||
static settings::Bool autojump("navbot.autojump.enabled", "false");
|
||||
@ -34,6 +35,7 @@ namespace task
|
||||
{
|
||||
task current_task;
|
||||
}
|
||||
constexpr bot_class_config DIST_SPY{ 300.0f, 500.0f, 1000.0f };
|
||||
constexpr bot_class_config DIST_OTHER{ 100.0f, 200.0f, 300.0f };
|
||||
constexpr bot_class_config DIST_SNIPER{ 1000.0f, 1500.0f, 3000.0f };
|
||||
|
||||
@ -57,13 +59,13 @@ static void CreateMove()
|
||||
if (getHealthAndAmmo())
|
||||
return;
|
||||
// Try to stay near enemies to increase efficiency
|
||||
if ((stay_near || heavy_mode) && current_task != task::followbot)
|
||||
if ((stay_near || heavy_mode || spy_mode) && current_task != task::followbot)
|
||||
if (stayNear())
|
||||
return;
|
||||
// We don't have anything else to do. Just nav to sniper spots.
|
||||
if (navToSniperSpot())
|
||||
return;
|
||||
// Uhh... Just stand arround I guess?
|
||||
// Uhh... Just stand around I guess?
|
||||
}
|
||||
|
||||
bool init(bool first_cm)
|
||||
@ -236,7 +238,11 @@ static bool stayNear()
|
||||
|
||||
// What distances do we have to use?
|
||||
const bot_class_config *config;
|
||||
if (heavy_mode)
|
||||
if (spy_mode)
|
||||
{
|
||||
config = &DIST_SPY;
|
||||
}
|
||||
else if (heavy_mode)
|
||||
{
|
||||
config = &DIST_OTHER;
|
||||
}
|
||||
@ -425,6 +431,8 @@ static int GetBestSlot()
|
||||
return primary;
|
||||
case tf_medic:
|
||||
return secondary;
|
||||
case tf_spy:
|
||||
return primary;
|
||||
default:
|
||||
{
|
||||
float nearest_dist = getNearestPlayerDistance().second;
|
||||
|
Reference in New Issue
Block a user