Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-06-06 00:07:04 +08:00
19 changed files with 269 additions and 138 deletions

View File

@@ -344,6 +344,32 @@ void MotionMaster::MoveBackwards(Unit* target, float dist)
init.Launch();
}
void MotionMaster::MoveForwards(Unit* target, float dist)
{
//like movebackwards, but without the inversion
if (!target)
{
return;
}
Position const& pos = target->GetPosition();
float angle = target->GetAngle(_owner);
G3D::Vector3 point;
point.x = pos.m_positionX + dist * cosf(angle);
point.y = pos.m_positionY + dist * sinf(angle);
point.z = pos.m_positionZ;
if (!_owner->GetMap()->CanReachPositionAndGetValidCoords(_owner, point.x, point.y, point.z, true, true))
{
return;
}
Movement::MoveSplineInit init(_owner);
init.MoveTo(point.x, point.y, point.z, false);
init.SetFacing(target);
init.Launch();
}
void MotionMaster::MoveCircleTarget(Unit* target)
{
if (!target)

View File

@@ -205,6 +205,7 @@ public:
void MoveChase(Unit* target, float dist) { MoveChase(target, ChaseRange(dist)); }
void MoveCircleTarget(Unit* target);
void MoveBackwards(Unit* target, float dist);
void MoveForwards(Unit* target, float dist);
void MoveConfused();
void MoveFleeing(Unit* enemy, uint32 time = 0);
void MovePoint(uint32 id, const Position& pos, bool generatePath = true, bool forceDestination = true)