fix: send heartbeat after SET_FACING before cast to ensure server has orientation

This commit is contained in:
Kelsi 2026-03-28 16:27:26 -07:00
parent 9cb6c596d5
commit 1aec1c6cf1

View file

@ -300,7 +300,9 @@ void SpellHandler::castSpell(uint32_t spellId, uint64_t targetGuid) {
}
}
// Face the target before casting any targeted spell (server checks facing arc)
// Face the target before casting any targeted spell (server checks facing arc).
// Send both SET_FACING and a HEARTBEAT so the server has the updated orientation
// before it processes the cast packet.
if (target != 0) {
auto entity = owner_.entityManager.getEntity(target);
if (entity) {
@ -310,6 +312,7 @@ void SpellHandler::castSpell(uint32_t spellId, uint64_t targetGuid) {
if (lenSq > 0.01f) {
owner_.movementInfo.orientation = std::atan2(dy, dx);
owner_.sendMovement(Opcode::MSG_MOVE_SET_FACING);
owner_.sendMovement(Opcode::MSG_MOVE_HEARTBEAT);
}
}
}