mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Unit Motion - Face point when calling StopMoving()
FacePointAfterMoving intends for the unit to face the destination once a
move is done. Since 4fda917f46, stopping is the responsibility of UnitAI
(through a call to StopMoving()). Thus we should move that code in that
function, as this ensures we don't forget to do it and removes
duplications.
Differential Revision: https://code.wildfiregames.com/D1889
This was SVN commit r22355.
This commit is contained in:
parent
f2db913a7d
commit
70e22e2923
1 changed files with 7 additions and 7 deletions
|
|
@ -518,6 +518,13 @@ public:
|
|||
|
||||
virtual void StopMoving()
|
||||
{
|
||||
if (m_FacePointAfterMove)
|
||||
{
|
||||
CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle());
|
||||
if (cmpPosition && cmpPosition->IsInWorld())
|
||||
FaceTowardsPointFromPos(cmpPosition->GetPosition2D(), m_FinalGoal.x, m_FinalGoal.z);
|
||||
}
|
||||
|
||||
m_MoveRequest = MoveRequest();
|
||||
m_ExpectedPathTicket = 0;
|
||||
m_State = STATE_STOPPING;
|
||||
|
|
@ -750,9 +757,6 @@ void CCmpUnitMotion::PathResult(u32 ticket, const WaypointPath& path)
|
|||
if (CloseEnoughFromDestinationToStop(pos))
|
||||
{
|
||||
MoveSucceeded();
|
||||
|
||||
if (m_FacePointAfterMove)
|
||||
FaceTowardsPointFromPos(pos, m_FinalGoal.x, m_FinalGoal.z);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -930,10 +934,6 @@ void CCmpUnitMotion::Move(fixed dt)
|
|||
if (CloseEnoughFromDestinationToStop(pos))
|
||||
{
|
||||
MoveSucceeded();
|
||||
|
||||
if (m_FacePointAfterMove)
|
||||
FaceTowardsPointFromPos(pos, m_FinalGoal.x, m_FinalGoal.z);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue