Core/Movement
* Moved enter/exit vehicle packets to spline. * Fixed spline movement on transports such as elevators (for which we do not keep track of its exact position) - path will be using normal coordinates (not transport offsets)
This commit is contained in:
1 parent
ee194a4f43
commit
810f21efbc
7 files changed
+91
-157
No files matched your search
@@ -424,50 +424,6 @@ void Unit::DisableSpline()
|
||||
movespline->_Interrupt();
|
||||
}
|
||||
|
||||
void Unit::SendMonsterMoveExitVehicle(Position const* newPos)
|
||||
{
|
||||
WorldPacket data(SMSG_MONSTER_MOVE, 1+12+4+1+4+4+4+12+GetPackGUID().size());
|
||||
data.append(GetPackGUID());
|
||||
|
||||
data << uint8(GetTypeId() == TYPEID_PLAYER ? 1 : 0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40)
|
||||
data << GetPositionX() << GetPositionY() << GetPositionZ();
|
||||
data << getMSTime();
|
||||
|
||||
data << uint8(SPLINETYPE_FACING_ANGLE);
|
||||
data << float(GetOrientation()); // guess
|
||||
data << uint32(SPLINEFLAG_TRANSPORT_EXIT);
|
||||
data << uint32(0); // Time in between points
|
||||
data << uint32(1); // 1 single waypoint
|
||||
data << newPos->GetPositionX();
|
||||
data << newPos->GetPositionY();
|
||||
data << newPos->GetPositionZ();
|
||||
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void Unit::SendMonsterMoveTransport(Unit* vehicleOwner)
|
||||
{
|
||||
// TODO: Turn into BuildMonsterMoveTransport packet and allow certain variables (for npc movement aboard vehicles)
|
||||
WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, GetPackGUID().size()+vehicleOwner->GetPackGUID().size() + 47);
|
||||
data.append(GetPackGUID());
|
||||
data.append(vehicleOwner->GetPackGUID());
|
||||
data << int8(GetTransSeat());
|
||||
data << uint8(0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40)
|
||||
data << GetPositionX() - vehicleOwner->GetPositionX();
|
||||
data << GetPositionY() - vehicleOwner->GetPositionY();
|
||||
data << GetPositionZ() - vehicleOwner->GetPositionZ();
|
||||
data << uint32(getMSTime()); // should be an increasing constant that indicates movement packet count
|
||||
data << uint8(SPLINETYPE_FACING_ANGLE);
|
||||
data << GetTransOffsetO(); // facing angle?
|
||||
data << uint32(SPLINEFLAG_TRANSPORT);
|
||||
data << uint32(GetTransTime()); // move time
|
||||
data << uint32(1); // amount of waypoints
|
||||
data << uint32(0); // waypoint X
|
||||
data << uint32(0); // waypoint Y
|
||||
data << uint32(0); // waypoint Z
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void Unit::resetAttackTimer(WeaponAttackType type)
|
||||
{
|
||||
m_attackTimer[type] = uint32(GetAttackTime(type) * m_modAttackSpeedPct[type]);
|
||||
@@ -16308,7 +16264,7 @@ Creature* Unit::GetVehicleCreatureBase() const
|
||||
uint64 Unit::GetTransGUID() const
|
||||
{
|
||||
if (GetVehicle())
|
||||
return GetVehicle()->GetBase()->GetGUID();
|
||||
return GetVehicleBase()->GetGUID();
|
||||
if (GetTransport())
|
||||
return GetTransport()->GetGUID();
|
||||
|
||||
@@ -17171,11 +17127,12 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
||||
Vehicle* vehicle = m_vehicle;
|
||||
m_vehicle = NULL;
|
||||
|
||||
SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
|
||||
SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
|
||||
|
||||
Position pos;
|
||||
if (!exitPosition) // Exit position not specified
|
||||
vehicle->GetBase()->GetPosition(&pos);
|
||||
if (!exitPosition) // Exit position not specified
|
||||
vehicle->GetBase()->GetPosition(&pos); // This should use passenger's current position, leaving it as it is now
|
||||
// because we calculate positions incorrect (sometimes under map)
|
||||
else
|
||||
pos = *exitPosition;
|
||||
|
||||
@@ -17190,14 +17147,17 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
||||
SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
SendMonsterMoveExitVehicle(&pos);
|
||||
Relocate(&pos);
|
||||
Movement::MoveSplineInit init(*this);
|
||||
init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
|
||||
init.SetFacing(GetOrientation());
|
||||
init.SetTransportExit();
|
||||
init.Launch();
|
||||
|
||||
//GetMotionMaster()->MoveFall(); // Enable this once passenger positions are calculater properly (see above)
|
||||
|
||||
if (Player* player = ToPlayer())
|
||||
player->ResummonPetTemporaryUnSummonedIfAny();
|
||||
|
||||
SendMovementFlagUpdate();
|
||||
|
||||
if (vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
|
||||
if (((Minion*)vehicle->GetBase())->GetOwner() == this)
|
||||
vehicle->Dismiss();
|
||||
|
||||
Reference in new issue
Block a user