1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-07-07 22:04:29 -04:00

NPC path: change mode before changing directions. (#271)

We need the data of the new mode before making a decision on what
direction to use.
This commit is contained in:
Ziemas 2019-12-29 05:33:30 +01:00 committed by Tim Sarbin
parent d6769975cd
commit 0876a2953d

View File

@ -160,9 +160,14 @@ func (v *AnimatedEntity) SetTarget(tx, ty float64, action int32) {
newAnimationMode = d2enum.AnimationModeMonsterWalk.String()
}
if newAnimationMode != v.animationMode {
v.SetMode(newAnimationMode, v.weaponClass, v.direction)
}
newDirection := angleToDirection(float64(angle), v.composite.GetDirectionCount())
if newDirection != v.GetDirection() || newAnimationMode != v.animationMode {
v.SetMode(newAnimationMode, v.weaponClass, newDirection)
if newDirection != v.GetDirection() {
v.SetMode(v.animationMode, v.weaponClass, newDirection)
}
}