diff options
author | Shauren <shauren.trinity@gmail.com> | 2012-03-23 00:48:32 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2012-03-23 00:48:32 +0100 |
commit | 479c0976abaa24ac12ba4c47116ee282332e273f (patch) | |
tree | b61b6ea565d192003bb171d9f5c9335bbbec9a91 /src | |
parent | 011a73e3e5d1e18508b6a594b9dc26a26ce374d6 (diff) |
Core/Creatures: Properly initialize m_zoneScript when it depends on zone id (OutdoorPvP/Battlefield) and fixed z offset for hovering creatures at creation
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Creature/Creature.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 47225c65396..1706a56a5ee 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -433,8 +433,8 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data) in relation to DisableGravity also. else if (GetByteValue(UNIT_FIELD_BYTES_1, 3) & UNIT_BYTE_1_FLAG_HOVER) - SetHover(true); - + SetHover(true); + */ // TODO: Shouldn't we check whether or not the creature is in water first? @@ -758,16 +758,14 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, return false; } + //! Relocate before CreateFromProto, to initialize coords and allow + //! returning correct zone id for selecting OutdoorPvP/Battlefield script + Relocate(x, y, z, ang); + //oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0; if (!CreateFromProto(guidlow, Entry, vehId, team, data)) return false; - //! Need to be called after CreateFromProto - if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) - z += GetFloatValue(UNIT_FIELD_HOVERHEIGHT); - - Relocate(x, y, z, ang); - if (!IsPositionValid()) { sLog->outError("Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang); @@ -794,6 +792,14 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, } LoadCreaturesAddon(); + + //! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there + if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) + z += GetFloatValue(UNIT_FIELD_HOVERHEIGHT); + + //! Relocate again with updated Z coord + Relocate(x, y, z, ang); + uint32 displayID = GetNativeDisplayId(); CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); if (minfo && !isTotem()) // Cancel load if no model defined or if totem |