@@ -140,7 +140,7 @@ MovementGeneratorType RotateMovementGenerator::GetMovementGeneratorType() const
140140
141141// ----------------------------------------------------//
142142
143- DistractMovementGenerator::DistractMovementGenerator (uint32 timer, float orientation) : _timer(timer), _orientation(orientation)
143+ DistractMovementGenerator::DistractMovementGenerator (uint32 timer, float orientation) : _timer(timer), _orientation(orientation), _originalOrientation( 0 .f)
144144{
145145 Mode = MOTION_MODE_DEFAULT;
146146 Priority = MOTION_PRIORITY_HIGHEST;
@@ -157,6 +157,8 @@ void DistractMovementGenerator::Initialize(Unit* owner)
157157 if (!owner->IsStandState ())
158158 owner->SetStandState (UNIT_STAND_STATE_STAND);
159159
160+ _originalOrientation = owner->GetOrientation ();
161+
160162 Movement::MoveSplineInit init (owner);
161163 init.MoveTo (PositionToVector3 (*owner), false );
162164 if (owner->HasUnitMovementFlag (MOVEMENTFLAG_ONTRANSPORT) && !owner->GetTransGUID ().IsEmpty ())
@@ -196,13 +198,8 @@ void DistractMovementGenerator::Finalize(Unit* owner, bool/* active*/, bool move
196198{
197199 AddFlag (MOVEMENTGENERATOR_FLAG_FINALIZED);
198200
199- // TODO: This code should be handled somewhere else
200- // If this is a creature, then return orientation to original position (for idle movement creatures)
201201 if (movementInform && HasFlag (MOVEMENTGENERATOR_FLAG_INFORM_ENABLED) && owner->GetTypeId () == TYPEID_UNIT)
202- {
203- float angle = owner->ToCreature ()->GetHomePosition ().GetOrientation ();
204- owner->SetFacingTo (angle);
205- }
202+ owner->SetFacingTo (_originalOrientation, true );
206203}
207204
208205MovementGeneratorType DistractMovementGenerator::GetMovementGeneratorType () const
0 commit comments