commit
84ebf0b9ad
@ -10,7 +10,7 @@ extern bool init;
|
||||
extern bool ReadyForCommands;
|
||||
extern std::vector<CNavArea> areas;
|
||||
std::vector<Vector> findPath(Vector loc, Vector dest);
|
||||
bool NavTo(Vector dest, bool navToLocalCenter = true, bool persistent = true);
|
||||
bool NavTo(Vector dest, bool navToLocalCenter = true, bool persistent = true, int instructionPriority = 5);
|
||||
int findClosestNavSquare(Vector vec);
|
||||
bool Prepare();
|
||||
void CreateMove();
|
||||
|
@ -153,8 +153,7 @@ void CreateMove()
|
||||
CachedEntity *med = nearestHealth();
|
||||
if (CE_GOOD(med))
|
||||
{
|
||||
nav::NavTo(med->m_vecOrigin());
|
||||
return;
|
||||
nav::NavTo(med->m_vecOrigin(), true, true , 7);
|
||||
}
|
||||
}
|
||||
if (HasLowAmmo() && cdr.test_and_set(5000))
|
||||
@ -162,8 +161,7 @@ void CreateMove()
|
||||
CachedEntity *ammo = nearestAmmo();
|
||||
if (CE_GOOD(ammo))
|
||||
{
|
||||
nav::NavTo(ammo->m_vecOrigin());
|
||||
return;
|
||||
nav::NavTo(ammo->m_vecOrigin(), true, true, 6);
|
||||
}
|
||||
}
|
||||
if (!nav::ReadyForCommands && !spy_mode && !heavy_mode)
|
||||
|
@ -259,13 +259,17 @@ static Timer inactivity{};
|
||||
static Timer lastJump{};
|
||||
static std::vector<Vector> crumbs;
|
||||
static bool ensureArrival;
|
||||
int priority = 0;
|
||||
|
||||
bool NavTo(Vector dest, bool navToLocalCenter, bool persistent)
|
||||
bool NavTo(Vector dest, bool navToLocalCenter, bool persistent,
|
||||
int instructionPriority)
|
||||
{
|
||||
if (CE_BAD(LOCAL_E))
|
||||
return false;
|
||||
if (!Prepare())
|
||||
return false;
|
||||
if (instructionPriority <= priority)
|
||||
return false;
|
||||
auto path = findPath(g_pLocalPlayer->v_Origin, dest);
|
||||
if (path.empty())
|
||||
return false;
|
||||
@ -273,9 +277,9 @@ bool NavTo(Vector dest, bool navToLocalCenter, bool persistent)
|
||||
crumbs = std::move(path);
|
||||
if (!navToLocalCenter)
|
||||
crumbs.erase(crumbs.begin());
|
||||
inactivity.update();
|
||||
ensureArrival = persistent;
|
||||
localAreas.clear();
|
||||
priority = instructionPriority;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -337,15 +341,23 @@ void CreateMove()
|
||||
return;
|
||||
if (CE_BAD(LOCAL_E))
|
||||
return;
|
||||
if (!LOCAL_E->m_bAlivePlayer())
|
||||
{
|
||||
crumbs.clear();
|
||||
return;
|
||||
}
|
||||
clearIgnores();
|
||||
if (crumbs.empty())
|
||||
{
|
||||
priority = 0;
|
||||
ReadyForCommands = true;
|
||||
ensureArrival = false;
|
||||
return;
|
||||
}
|
||||
ReadyForCommands = false;
|
||||
if (g_pLocalPlayer->v_Origin.DistTo(Vector{crumbs.at(0).x, crumbs.at(0).y, g_pLocalPlayer->v_Origin.z}) < 30.0f)
|
||||
if (g_pLocalPlayer->v_Origin.DistTo(Vector{ crumbs.at(0).x, crumbs.at(0).y,
|
||||
g_pLocalPlayer->v_Origin.z }) <
|
||||
30.0f)
|
||||
{
|
||||
lastArea = crumbs.at(0);
|
||||
crumbs.erase(crumbs.begin());
|
||||
@ -410,7 +422,7 @@ CatCommand navfind("nav_find", "Debug nav find", [](const CCommand &args) {
|
||||
});
|
||||
|
||||
CatCommand navpath("nav_path", "Debug nav path", [](const CCommand &args) {
|
||||
if (NavTo(loc, true, true))
|
||||
if (NavTo(loc, true, true, 50 + priority))
|
||||
{
|
||||
logging::Info("Pathing: Success! Walking to path...");
|
||||
}
|
||||
|
Reference in New Issue
Block a user