Core/Vehicles:

- Allow specifying of exit position for Unit::ExitVehicle
- On Vehicle::InstallAccessory, despawn any accessory in the current seat with the same entry with TEMPSUMMON_MANUAL_DESPAWN type
- Remove hacky TELEPORT_ACK packet on vehicle exit
- Remove some redundant packet send operations that were already handled elsewhere
This commit is contained in:
Machiavelli
2011-02-25 01:38:21 +01:00
parent a6e30e0509
commit 04b656a44f
4 changed files with 26 additions and 28 deletions

View File

@@ -35,6 +35,7 @@ class TempSummon : public Creature
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) {}
Unit* GetSummoner() const;
uint64 const& GetSummonerGUID() { return m_summonerGUID; }
TempSummonType const& GetSummonType() { return m_type; }
const SummonPropertiesEntry * const m_Properties;
private:

View File

@@ -16506,7 +16506,7 @@ void Unit::ChangeSeat(int8 seatId, bool next)
ASSERT(false);
}
void Unit::ExitVehicle()
void Unit::ExitVehicle(Position const* exitPosition)
{
if (!m_vehicle)
return;
@@ -16525,23 +16525,26 @@ void Unit::ExitVehicle()
if (!m_vehicle)
return;
//sLog->outError("exit vehicle");
m_vehicle->RemovePassenger(this);
// This should be done before dismiss, because there may be some aura removal
Vehicle *vehicle = m_vehicle;
m_vehicle = NULL;
SetControlled(false, UNIT_STAT_ROOT);
SetControlled(false, UNIT_STAT_ROOT); // SMSG_MOVE_FORCE_UNROOT
if (exitPosition) // Exit position specified
Relocate(exitPosition);
else
Relocate(vehicle->GetBase()); // Relocate to vehicle base
//Send leave vehicle, not correct
if (GetTypeId() == TYPEID_PLAYER)
{
//this->ToPlayer()->SetClientControl(this, 1);
this->ToPlayer()->SendTeleportAckPacket();
this->ToPlayer()->SetFallInformation(0, GetPositionZ());
}
WorldPacket data;
BuildHeartBeatMsg(&data);
SendMessageToSet(&data, false);

View File

@@ -2058,7 +2058,7 @@ class Unit : public WorldObject
bool CheckPlayerCondition(Player* pPlayer);
void EnterVehicle(Unit *base, int8 seatId = -1, AuraApplication const * aurApp = NULL) { EnterVehicle(base->GetVehicleKit(), seatId, aurApp); }
void EnterVehicle(Vehicle *vehicle, int8 seatId = -1, AuraApplication const * aurApp = NULL);
void ExitVehicle();
void ExitVehicle(Position const* exitPosition = NULL);
void ChangeSeat(int8 seatId, bool next = true);
void BuildMovementPacket(ByteBuffer *data) const;

View File

@@ -256,11 +256,23 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ
if (passenger->GetEntry() == entry)
{
ASSERT(passenger->GetTypeId() == TYPEID_UNIT);
if (me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled)
passenger->ToCreature()->AI()->EnterEvadeMode();
return;
if (me->GetTypeId() == TYPEID_UNIT)
{
if (me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled)
{
passenger->ToCreature()->AI()->EnterEvadeMode();
return;
}
else if (passenger->ToTempSummon()->GetSummonType() == TEMPSUMMON_MANUAL_DESPAWN)
{
passenger->ExitVehicle();
passenger->ToTempSummon()->DespawnOrUnsummon();
ASSERT(!GetPassenger(seatId))
}
}
}
passenger->ExitVehicle(); // this should not happen
else
passenger->ExitVehicle(); // this should not happen
}
if (Creature *accessory = me->SummonCreature(entry, *me, TempSummonType(type), summonTime))
@@ -361,14 +373,6 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
if (me->IsInWorld())
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
{
WorldPacket data(SMSG_FORCE_MOVE_ROOT, 8+4);
data.append(me->GetPackGUID());
data << uint32(2); // Counter
me->SendMessageToSet(&data, false);
}
// In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
unit->SendMonsterMoveTransport(me);
@@ -429,20 +433,10 @@ void Vehicle::RemovePassenger(Unit *unit)
if (me->IsInWorld())
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
{
WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4);
data.append(me->GetPackGUID());
data << uint32(2); // Counter
me->SendMessageToSet(&data, false);
}
unit->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
unit->m_movementInfo.t_pos.Relocate(0, 0, 0, 0);
unit->m_movementInfo.t_time = 0;
unit->m_movementInfo.t_seat = 0;
unit->Relocate(GetBase());
}
if (me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsAIEnabled)