Skip to content

Instantly share code, notes, and snippets.

@SilverIce
Created July 10, 2011 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SilverIce/1074905 to your computer and use it in GitHub Desktop.
Save SilverIce/1074905 to your computer and use it in GitHub Desktop.
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index e9205a5..bf282e6 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -509,6 +509,8 @@ void Creature::Update(uint32 update_diff, uint32 diff)
}
case CORPSE:
{
+ Unit::Update(update_diff, diff);
+
if (m_isDeadByDefault)
break;
@@ -1492,7 +1494,7 @@ void Creature::SetDeathState(DeathState s)
Unit::SetDeathState(ALIVE);
clearUnitState(UNIT_STAT_ALL_STATE);
- i_motionMaster.Clear();
+ i_motionMaster.Initialize();
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
@@ -1541,8 +1543,8 @@ bool Creature::FallGround()
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();
+ //GetMap()->CreatureRelocation(this, GetPositionX(), GetPositionY(), tz, GetOrientation());
+ //DisableSpline();
return true;
}
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 5b27d08..1f5dc6c 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8361,8 +8361,10 @@ void Unit::SetDeathState(DeathState s)
RemoveMiniPet();
UnsummonAllTotems();
+ i_motionMaster.Clear(false,true);
+ i_motionMaster.MoveIdle();
StopMoving();
- DisableSpline();
+ //DisableSpline();
ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false);
ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false);
@rsa
Copy link

rsa commented Jul 11, 2011

way like this tested in my branch approx half year. works good.

@SilverIce
Copy link
Author

thanks for reply
i have found your comment only now, gist didn't notified me =\

you call update for events and spells only, while Unit::Update causes more things to be updated
maybe you can test this in your branch?

@rsa
Copy link

rsa commented Jul 28, 2011

i not sure, there updating movement for dead units is needed... but really, need to test. 'll test immediately after the finish worldlock chain.

@SilverIce
Copy link
Author

the main thing i afraid is update spells and etc - but as i can see you already doing this and there is no problems for you

i not sure, there updating movement for dead units is needed...

this needed to remove some hacks from our code(like died creature falling). Corpses should be able to move (but ofc they shouldn't chase you^^)

'll test immediately after the finish worldlock chain.

it would be nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment