[10759] Correctly reset mob orientation upon reaching spawn point. Should also improve visualisation of mob orientation on clients

Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
Schmoozerd 2010-11-20 19:38:02 +02:00 committed by Ambal
parent 07c48c77c9
commit ca56284912
5 changed files with 13 additions and 3 deletions

View file

@ -72,9 +72,10 @@ HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff
// restore orientation of not moving creature at returning to home // restore orientation of not moving creature at returning to home
if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE) if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE)
{ {
// such a mob might need very exact spawning point, hence relocate to spawn-position
if (CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow())) if (CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow()))
{ {
owner.SetOrientation(data->orientation); owner.Relocate(data->posX, data->posY, data->posZ, data->orientation);
owner.SendHeartBeat(false); owner.SendHeartBeat(false);
} }
} }

View file

@ -1158,6 +1158,14 @@ void WorldObject::Relocate(float x, float y, float z)
((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, GetOrientation()); ((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, GetOrientation());
} }
void WorldObject::SetOrientation(float orientation)
{
m_orientation = orientation;
if(isType(TYPEMASK_UNIT))
((Unit*)this)->m_movementInfo.ChangeOrientation(orientation);
}
uint32 WorldObject::GetZoneId() const uint32 WorldObject::GetZoneId() const
{ {
return GetTerrain()->GetZoneId(m_positionX, m_positionY, m_positionZ); return GetTerrain()->GetZoneId(m_positionX, m_positionY, m_positionZ);

View file

@ -350,7 +350,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
void Relocate(float x, float y, float z, float orientation); void Relocate(float x, float y, float z, float orientation);
void Relocate(float x, float y, float z); void Relocate(float x, float y, float z);
void SetOrientation(float orientation) { m_orientation = orientation; } void SetOrientation(float orientation);
float GetPositionX( ) const { return m_positionX; } float GetPositionX( ) const { return m_positionX; }
float GetPositionY( ) const { return m_positionY; } float GetPositionY( ) const { return m_positionY; }

View file

@ -791,6 +791,7 @@ class MovementInfo
int8 GetTransportSeat() const { return t_seat; } int8 GetTransportSeat() const { return t_seat; }
uint32 GetTransportTime() const { return t_time; } uint32 GetTransportTime() const { return t_time; }
uint32 GetFallTime() const { return fallTime; } uint32 GetFallTime() const { return fallTime; }
void ChangeOrientation(float o) { pos.o = o; }
void ChangePosition(float x, float y, float z, float o) { pos.x = x; pos.y = y; pos.z = z; pos.o = o; } void ChangePosition(float x, float y, float z, float o) { pos.x = x; pos.y = y; pos.z = z; pos.o = o; }
void UpdateTime(uint32 _time) { time = _time; } void UpdateTime(uint32 _time) { time = _time; }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10758" #define REVISION_NR "10759"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__