Some tweaks so its harder to get npcs intentionally stuck

This commit is contained in:
KimLS 2018-05-20 17:24:00 -07:00
parent 80c7643396
commit f46e4f9aa4
2 changed files with 11 additions and 4 deletions

View File

@ -931,7 +931,9 @@ bool Mob::CombatRange(Mob* other)
if (size_mod > 10000)
size_mod = size_mod / 7;
float _DistNoRoot = DistanceSquared(m_Position, other->GetPosition());
float _DistNoRoot = DistanceSquaredNoZ(m_Position, other->GetPosition());
float _zDist = m_Position.z - other->GetZ();
_zDist *= _zDist;
if (GetSpecialAbility(NPC_CHASE_DISTANCE)){
@ -960,6 +962,11 @@ bool Mob::CombatRange(Mob* other)
if (_DistNoRoot <= size_mod)
{
//A hack to kill an exploit till we get something better.
if (flymode == 0 && _zDist > 500 && !CheckLastLosState()) {
return false;
}
return true;
}
return false;

View File

@ -59,12 +59,12 @@ IPathfinder::IPath PathfinderNavmesh::FindRoute(const glm::vec3 &start, const gl
filter.setAreaCost(6, 1.5f); //Ice
filter.setAreaCost(7, 3.0f); //V Water (Frigid Water)
filter.setAreaCost(8, 1.0f); //General Area
filter.setAreaCost(9, 1.0f); //Portal
filter.setAreaCost(10, 0.5f); //Prefer
filter.setAreaCost(9, 0.1f); //Portal
filter.setAreaCost(10, 0.1f); //Prefer
dtPolyRef start_ref;
dtPolyRef end_ref;
glm::vec3 ext(15.0f, 100.0f, 15.0f);
glm::vec3 ext(5.0f, 100.0f, 5.0f);
m_impl->query->findNearestPoly(&current_location[0], &ext[0], &filter, &start_ref, 0);
m_impl->query->findNearestPoly(&dest_location[0], &ext[0], &filter, &end_ref, 0);