Core/Movement: do not use mmap raycasts when the movement generator owner is ignoring pathfinding (units on transport for example)

This commit is contained in:
Ovahlord
2020-04-22 17:54:27 +02:00
parent b22f52acfa
commit 1646f2a53d
2 changed files with 11 additions and 7 deletions

View File

@@ -208,14 +208,16 @@ void ChaseMovementGenerator::LaunchMovement(Unit* owner, Unit* target, float cha
float additionalRange = target->GetSpeed(moveType) * 0.5f;
target->MovePositionToFirstCollision(dest, additionalRange, _angle ? target->NormalizeOrientation(target->GetOrientation() - _angle->RelativeAngle + float(M_PI)) : target->GetRelativeAngle(owner) + float(M_PI));
if (!owner->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING))
target->MovePositionToFirstCollision(dest, additionalRange, _angle ? target->NormalizeOrientation(target->GetOrientation() - _angle->RelativeAngle + float(M_PI)) : target->GetRelativeAngle(owner) + float(M_PI));
}
else
else if (!owner->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING))
target->MovePositionToFirstCollision(dest, chaseRange, _angle ? target->NormalizeOrientation(target->GetOrientation() - _angle->RelativeAngle) : target->GetRelativeAngle(owner));
owner->UpdateAllowedPositionZ(dest.GetPositionX(), dest.GetPositionY(), dest.m_positionZ);
Creature* creature = owner->ToCreature();
Movement::MoveSplineInit init(owner);
PathGenerator path(owner);
bool success = path.CalculatePath(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), owner->CanFly());
@@ -228,7 +230,6 @@ void ChaseMovementGenerator::LaunchMovement(Unit* owner, Unit* target, float cha
return;
}
Movement::MoveSplineInit init(owner);
init.MovebyPath(path.GetPath());
init.SetWalk(false);
if (backward)

View File

@@ -161,10 +161,13 @@ bool FollowMovementGenerator::Update(Unit* owner, uint32 diff)
dest.m_positionY += std::sin(Position::NormalizeOrientation(target->GetOrientation() + offset)) * (velocity * 2);
// Now we calculate out actual destination data
float relativeAngle = target->GetRelativeAngle(dest);
float distance = target->GetExactDist2d(dest);
dest = target->GetPosition();
target->MovePositionToFirstCollision(dest, distance, relativeAngle);
if (!owner->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING))
{
float relativeAngle = target->GetRelativeAngle(dest);
float distance = target->GetExactDist2d(dest);
dest = target->GetPosition();
target->MovePositionToFirstCollision(dest, distance, relativeAngle);
}
Movement::MoveSplineInit init(owner);
init.MoveTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ());