Core/Movement: Fixed transport teleports on the same map (and teleporting on transports too)

This commit is contained in:
hondacrx
2018-03-18 20:13:53 -04:00
parent 7c37ef6f69
commit 0570f2aa3b
4 changed files with 8 additions and 5 deletions
@@ -2734,7 +2734,7 @@ namespace Game.Entities
public ObjectGuid lootingGroupLowGUID; // used to find group which is looting public ObjectGuid lootingGroupLowGUID; // used to find group which is looting
long m_packedRotation; long m_packedRotation;
Quaternion m_worldRotation; Quaternion m_worldRotation;
Position m_stationaryPosition; public Position m_stationaryPosition { get; set; }
GameObjectAI m_AI; GameObjectAI m_AI;
ushort _animKitId; ushort _animKitId;
+5 -2
View File
@@ -519,8 +519,10 @@ namespace Game.Entities
public void UpdatePosition(float x, float y, float z, float o) public void UpdatePosition(float x, float y, float z, float o)
{ {
bool newActive = GetMap().IsGridLoaded(x, y); bool newActive = GetMap().IsGridLoaded(x, y);
Cell oldCell = new Cell(GetPositionX(), GetPositionY());
Relocate(x, y, z, o); Relocate(x, y, z, o);
m_stationaryPosition.SetOrientation(o);
UpdateModelPosition(); UpdateModelPosition();
UpdatePassengerPositions(_passengers); UpdatePassengerPositions(_passengers);
@@ -533,7 +535,7 @@ namespace Game.Entities
*/ */
if (_staticPassengers.Empty() && newActive) // 1. and 2. if (_staticPassengers.Empty() && newActive) // 1. and 2.
LoadStaticPassengers(); LoadStaticPassengers();
else if (!_staticPassengers.Empty() && !newActive && new Cell(x, y).DiffGrid(new Cell(GetPositionX(), GetPositionY()))) // 3. else if (!_staticPassengers.Empty() && !newActive && oldCell.DiffGrid(new Cell(GetPositionX(), GetPositionY()))) // 3.
UnloadStaticPassengers(); UnloadStaticPassengers();
else else
UpdatePassengerPositions(_staticPassengers); UpdatePassengerPositions(_staticPassengers);
@@ -632,6 +634,8 @@ namespace Game.Entities
} }
else else
{ {
UpdatePosition(x, y, z, o);
// Teleport players, they need to know it // Teleport players, they need to know it
foreach (var obj in _passengers) foreach (var obj in _passengers)
{ {
@@ -651,7 +655,6 @@ namespace Game.Entities
} }
} }
UpdatePosition(x, y, z, o);
return false; return false;
} }
} }
+1 -1
View File
@@ -3096,7 +3096,7 @@ namespace Game.Maps
public Creature GetCreature(ObjectGuid guid) public Creature GetCreature(ObjectGuid guid)
{ {
if (!guid.IsCreature()) if (!guid.IsCreatureOrVehicle())
return null; return null;
return (Creature)_objectsStore.LookupByKey(guid); return (Creature)_objectsStore.LookupByKey(guid);
@@ -545,8 +545,8 @@ namespace Game.Network.Packets
_worldPacket.WriteFloat(Facing); _worldPacket.WriteFloat(Facing);
_worldPacket.WriteUInt8(PreloadWorld); _worldPacket.WriteUInt8(PreloadWorld);
_worldPacket.WriteBit(Vehicle.HasValue);
_worldPacket.WriteBit(TransportGUID.HasValue); _worldPacket.WriteBit(TransportGUID.HasValue);
_worldPacket.WriteBit(Vehicle.HasValue);
_worldPacket.FlushBits(); _worldPacket.FlushBits();
if (Vehicle.HasValue) if (Vehicle.HasValue)