mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +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();
|
||||
|
|
|
|||
|
|
@ -582,7 +582,6 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
|||
const char* GetNameForLocaleIdx(int32 locale_idx) const;
|
||||
|
||||
void SetDeathState(DeathState s); // overwrite virtual Unit::SetDeathState
|
||||
bool FallGround();
|
||||
|
||||
bool LoadFromDB(uint32 guid, Map *map);
|
||||
void SaveToDB();
|
||||
|
|
|
|||
|
|
@ -480,3 +480,25 @@ void MotionMaster::MoveJump(float x, float y, float z, float horizontalSpeed, fl
|
|||
init.Launch();
|
||||
Mutate(new EffectMovementGenerator(id));
|
||||
}
|
||||
|
||||
void MotionMaster::MoveFall()
|
||||
{
|
||||
// use larger distance for vmap height search than in most other cases
|
||||
float tz = m_owner->GetTerrain()->GetHeight(m_owner->GetPositionX(), m_owner->GetPositionY(), m_owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
|
||||
if (tz <= INVALID_HEIGHT)
|
||||
{
|
||||
DEBUG_LOG("MotionMaster::MoveFall: unit %u at map %u (x: %f, y: %f, z: %f), not able to retrive a proper GetHeight (z: %f).",
|
||||
m_owner->GetMap()->GetId(), m_owner->GetPositionX(), m_owner->GetPositionX(), m_owner->GetPositionZ(), tz);
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort too if the ground is very near
|
||||
if (fabs(m_owner->GetPositionZ() - tz) < 0.1f)
|
||||
return;
|
||||
|
||||
Movement::MoveSplineInit init(*m_owner);
|
||||
init.MoveTo(m_owner->GetPositionX(),m_owner->GetPositionY(),tz);
|
||||
init.SetFall();
|
||||
init.Launch();
|
||||
Mutate(new EffectMovementGenerator(0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *>
|
|||
void MoveTaxiFlight(uint32 path, uint32 pathnode);
|
||||
void MoveDistract(uint32 timeLimit);
|
||||
void MoveJump(float x, float y, float z, float horizontalSpeed, float max_height, uint32 id = 0);
|
||||
void MoveFall();
|
||||
|
||||
MovementGeneratorType GetCurrentMovementGeneratorType() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -376,7 +376,6 @@ enum DeathState
|
|||
CORPSE = 2, // corpse state, for player this also meaning that player not leave corpse
|
||||
DEAD = 3, // for creature despawned state (corpse despawned), for player CORPSE/DEAD not clear way switches (FIXME), and use m_deathtimer > 0 check for real corpse state
|
||||
JUST_ALIVED = 4, // temporary state at resurrection, for creature auto converted to ALIVE, for player at next update call
|
||||
CORPSE_FALLING = 5 // corpse state in case when corpse still falling to ground
|
||||
};
|
||||
|
||||
// internal state flags for some auras and movement generators, other.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11825"
|
||||
#define REVISION_NR "11826"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue