mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-17 23:12:27 +00:00
Make fear and fleeing respect navmesh for both clients and NPCs
This commit is contained in:
parent
8a580a7774
commit
8a28e8500d
@ -155,19 +155,21 @@ void Mob::ProcessFlee()
|
||||
}
|
||||
}
|
||||
|
||||
void Mob::CalculateNewFearpoint()
|
||||
{
|
||||
if(RuleB(Pathing, Fear) && zone->pathing)
|
||||
{
|
||||
void Mob::CalculateNewFearpoint() {
|
||||
if (RuleB(Pathing, Fear) && zone->pathing) {
|
||||
auto Node = zone->pathing->GetRandomLocation();
|
||||
if (Node.x != 0.0f || Node.y != 0.0f || Node.z != 0.0f) {
|
||||
|
||||
++Node.z;
|
||||
m_FearWalkTarget = Node;
|
||||
currently_fleeing = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::None, "No path found to selected node. Falling through to old fear point selection.");
|
||||
Log(Logs::Detail,
|
||||
Logs::Pathing,
|
||||
"No path found to selected node. Falling through to old fear point selection.");
|
||||
}
|
||||
|
||||
int loop = 0;
|
||||
@ -184,8 +186,7 @@ void Mob::CalculateNewFearpoint()
|
||||
if (ranz == BEST_Z_INVALID)
|
||||
continue;
|
||||
float fdist = ranz - GetZ();
|
||||
if (fdist >= -12 && fdist <= 12 && CheckCoordLosNoZLeaps(GetX(),GetY(),GetZ(),ranx,rany,ranz))
|
||||
{
|
||||
if (fdist >= -12 && fdist <= 12 && CheckCoordLosNoZLeaps(GetX(), GetY(), GetZ(), ranx, rany, ranz)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1142,8 +1142,12 @@ void Mob::AI_Process() {
|
||||
bool WaypointChanged, NodeReached;
|
||||
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z,
|
||||
GetFearSpeed(), WaypointChanged, NodeReached
|
||||
m_FearWalkTarget.x,
|
||||
m_FearWalkTarget.y,
|
||||
m_FearWalkTarget.z,
|
||||
GetFearSpeed(),
|
||||
WaypointChanged,
|
||||
NodeReached
|
||||
);
|
||||
|
||||
if (WaypointChanged)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user