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