Fear pathing fixups, random path rewrite, and nektulos / general roambox fixups where best Z axis is below the ground

This commit is contained in:
E Spause
2018-10-19 22:35:38 -04:00
parent 904bc3e004
commit e466f9b3f9
9 changed files with 44 additions and 42 deletions
+3 -25
View File
@@ -157,41 +157,19 @@ void Mob::ProcessFlee()
void Mob::CalculateNewFearpoint() {
if (RuleB(Pathing, Fear) && zone->pathing) {
auto Node = zone->pathing->GetRandomLocation();
auto Node = zone->pathing->GetRandomLocation(glm::vec3(GetX(), GetY(), GetZ()));
if (Node.x != 0.0f || Node.y != 0.0f || Node.z != 0.0f) {
++Node.z;
m_FearWalkTarget = Node;
currently_fleeing = true;
return;
}
Stun(6000);
Log(Logs::Detail,
Logs::Pathing,
"No path found to selected node. Falling through to old fear point selection.");
}
int loop = 0;
float ranx, rany, ranz;
currently_fleeing = true;
while (loop < 100) //Max 100 tries
{
int ran = 250 - (loop * 2);
loop++;
ranx = GetX() + zone->random.Int(0, ran - 1) - zone->random.Int(0, ran - 1);
rany = GetY() + zone->random.Int(0, ran - 1) - zone->random.Int(0, ran - 1);
ranz = FindGroundZ(ranx, rany);
if (ranz == BEST_Z_INVALID)
continue;
float fdist = ranz - GetZ();
if (fdist >= -12 && fdist <= 12 && CheckCoordLosNoZLeaps(GetX(), GetY(), GetZ(), ranx, rany, ranz)) {
break;
}
}
if (currently_fleeing)
m_FearWalkTarget = glm::vec3(ranx, rany, ranz);
}