mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[11826] remove no more needed CORPSE_FALLING state, move FallGround method to more appropriate place
This commit is contained in:
parent
70a6a1ce76
commit
6edfcea7f0
6 changed files with 26 additions and 39 deletions
|
|
@ -592,10 +592,6 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
|||
RegenerateAll(update_diff);
|
||||
break;
|
||||
}
|
||||
case CORPSE_FALLING:
|
||||
{
|
||||
SetDeathState(CORPSE);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1480,9 +1476,8 @@ void Creature::SetDeathState(DeathState s)
|
|||
UpdateSpeed(MOVE_RUN, false);
|
||||
}
|
||||
|
||||
// return, since we promote to CORPSE_FALLING. CORPSE_FALLING is promoted to CORPSE at next update.
|
||||
if (CanFly() && FallGround())
|
||||
return;
|
||||
if (CanFly())
|
||||
i_motionMaster.MoveFall();
|
||||
|
||||
Unit::SetDeathState(CORPSE);
|
||||
}
|
||||
|
|
@ -1517,35 +1512,6 @@ void Creature::SetDeathState(DeathState s)
|
|||
}
|
||||
}
|
||||
|
||||
bool Creature::FallGround()
|
||||
{
|
||||
// Only if state is JUST_DIED. CORPSE_FALLING is set below and promoted to CORPSE later
|
||||
if (getDeathState() != JUST_DIED)
|
||||
return false;
|
||||
|
||||
// use larger distance for vmap height search than in most other cases
|
||||
float tz = GetTerrain()->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true, MAX_FALL_DISTANCE);
|
||||
|
||||
if (tz <= INVALID_HEIGHT)
|
||||
{
|
||||
DEBUG_LOG("FallGround: creature %u at map %u (x: %f, y: %f, z: %f), not able to retrive a proper GetHeight (z: %f).",
|
||||
GetEntry(), GetMap()->GetId(), GetPositionX(), GetPositionX(), GetPositionZ(), tz);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Abort too if the ground is very near
|
||||
if (fabs(GetPositionZ() - tz) < 0.1f)
|
||||
return false;
|
||||
|
||||
Unit::SetDeathState(CORPSE_FALLING);
|
||||
|
||||
Movement::MoveSplineInit init(*this);
|
||||
init.MoveTo(GetPositionX(),GetPositionY(),tz);
|
||||
init.SetFall();
|
||||
init.Launch();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Creature::Respawn()
|
||||
{
|
||||
RemoveCorpse();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue