fix(Scripts/ICC): Fix Valkyr "teleportation" effect caused by movement desynchronization between server and client. (#20080)
This commit is contained in:
committed by
GitHub
parent
67f587d958
commit
2e0a57084c
@@ -2417,6 +2417,8 @@ public:
|
|||||||
ObjectGuid _grabbedPlayer;
|
ObjectGuid _grabbedPlayer;
|
||||||
bool didbelow50pct;
|
bool didbelow50pct;
|
||||||
bool dropped;
|
bool dropped;
|
||||||
|
bool grabbed;
|
||||||
|
float _lastSpeed;
|
||||||
InstanceScript* _instance;
|
InstanceScript* _instance;
|
||||||
|
|
||||||
bool IsHeroic() { return me->GetMap()->IsHeroic(); }
|
bool IsHeroic() { return me->GetMap()->IsHeroic(); }
|
||||||
@@ -2547,6 +2549,8 @@ public:
|
|||||||
if (me->HasUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED))
|
if (me->HasUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
HandleSpeedChangeIfNeeded();
|
||||||
|
|
||||||
switch (_events.ExecuteEvent())
|
switch (_events.ExecuteEvent())
|
||||||
{
|
{
|
||||||
case EVENT_GRAB_PLAYER:
|
case EVENT_GRAB_PLAYER:
|
||||||
@@ -2557,6 +2561,8 @@ public:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVENT_MOVE_TO_DROP_POS:
|
case EVENT_MOVE_TO_DROP_POS:
|
||||||
|
grabbed = true;
|
||||||
|
_lastSpeed = me->GetSpeed(MOVE_WALK);
|
||||||
me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
|
me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
|
||||||
me->SetCanFly(false);
|
me->SetCanFly(false);
|
||||||
me->SetDisableGravity(false);
|
me->SetDisableGravity(false);
|
||||||
@@ -2596,6 +2602,24 @@ public:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For some reason, when the Valkyr has a slowdown effect, the speed of PointMovementGenerator
|
||||||
|
// and the speed on the client side differ, which leads to a "teleportation" effect when a stun aura is applied.
|
||||||
|
// Restarting the motion master on speed change ensures the movement is synced between the server and client.
|
||||||
|
void HandleSpeedChangeIfNeeded()
|
||||||
|
{
|
||||||
|
if (!grabbed || dropped)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (me->GetSpeed(MOVE_WALK) == _lastSpeed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_lastSpeed = me->GetSpeed(MOVE_WALK);
|
||||||
|
me->GetMotionMaster()->Clear();
|
||||||
|
me->StopMovingOnCurrentPos();
|
||||||
|
|
||||||
|
_events.ScheduleEvent(EVENT_MOVE_TO_DROP_POS, 0);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
CreatureAI* GetAI(Creature* creature) const override
|
||||||
|
|||||||
Reference in New Issue
Block a user