From 012be82c8632d59e922ca0f230a7f73ec82b8503 Mon Sep 17 00:00:00 2001 From: SilverIce Date: Thu, 13 Oct 2011 15:44:12 +0300 Subject: [PATCH] [11818] update creature's unit part(update spell events, auras, movement) while in death. thanks to rsa for making tests this allows us update creature's death persistent auras, fall died creatures in natural, non hacky way also fix the bug that creature starts waypoint movement not from begining at respawning. thanks to Grz3s for reporting --- src/game/Creature.cpp | 13 +++---------- src/game/Unit.cpp | 3 ++- src/shared/revision_nr.h | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 55739dda2..9e01f1cb1 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -511,6 +511,8 @@ void Creature::Update(uint32 update_diff, uint32 diff) } case CORPSE: { + Unit::Update(update_diff, diff); + if (m_isDeadByDefault) break; @@ -1495,7 +1497,7 @@ void Creature::SetDeathState(DeathState s) Unit::SetDeathState(ALIVE); clearUnitState(UNIT_STAT_ALL_STATE); - i_motionMaster.Clear(); + i_motionMaster.Initialize(); SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool)); @@ -1533,19 +1535,10 @@ bool Creature::FallGround() Unit::SetDeathState(CORPSE_FALLING); - // For creatures that are moving towards target and dies, the visual effect is not nice. - // It is possibly caused by a xyz mismatch in DestinationHolder's GetLocationNow and the location - // of the mob in client. For mob that are already reached target or dies while not moving - // the visual appear to be fairly close to the expected. - Movement::MoveSplineInit init(*this); init.MoveTo(GetPositionX(),GetPositionY(),tz); init.SetFall(); init.Launch(); - - // hacky solution: by some reason died creatures not updated, that's why need finalize movement state - GetMap()->CreatureRelocation(this, GetPositionX(), GetPositionY(), tz, GetOrientation()); - DisableSpline(); return true; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 33fe48262..5bbeb130f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8350,8 +8350,9 @@ void Unit::SetDeathState(DeathState s) RemoveMiniPet(); UnsummonAllTotems(); + i_motionMaster.Clear(false,true); + i_motionMaster.MoveIdle(); StopMoving(); - DisableSpline(); ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false); ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 841557cd5..060f508d6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11817" + #define REVISION_NR "11818" #endif // __REVISION_NR_H__