Core/Movement: sync spline code with master branch
This commit is contained in:
1 parent
dfa6f7a709
commit
770f9e11db
10 files changed
+143
-138
No files matched your search
@@ -542,9 +542,8 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
|
||||
if (arrived)
|
||||
{
|
||||
DisableSpline();
|
||||
|
||||
if (movespline->HasAnimation())
|
||||
SetAnimationTier(movespline->GetAnimationTier());
|
||||
if (Optional<AnimationTier> animTier = movespline->GetAnimation())
|
||||
SetAnimationTier(*animTier);
|
||||
}
|
||||
|
||||
UpdateSplinePosition();
|
||||
@@ -564,6 +563,8 @@ void Unit::UpdateSplinePosition()
|
||||
|
||||
if (TransportBase* transport = GetDirectTransport())
|
||||
transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasUnitState(UNIT_STATE_CANNOT_TURN))
|
||||
@@ -13649,6 +13650,21 @@ void Unit::SetFacingToObject(WorldObject const* object, bool force)
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
void Unit::SetFacingToPoint(Position const& point, bool force)
|
||||
{
|
||||
// do not face when already moving
|
||||
if (!force && (!IsStopped() || !movespline->Finalized()))
|
||||
return;
|
||||
|
||||
/// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is.
|
||||
Movement::MoveSplineInit init(this);
|
||||
init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
|
||||
if (GetTransport())
|
||||
init.DisableTransportPathTransformations(); // It makes no sense to target global orientation
|
||||
init.SetFacing(point.GetPositionX(), point.GetPositionY(), point.GetPositionZ());
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
bool Unit::SetWalk(bool enable)
|
||||
{
|
||||
if (enable == IsWalking())
|
||||
|
||||
Reference in new issue
Block a user