Core/TempSummon: Implement ForcedUnsummonDelayEvent. Similar to ForcedDespawnEvent for Creatures, this will unsummon TempSummon objects with specified delay.

Core/Vehicles: Implement ForcedUnsummonDelayEvent for creatures exiting vehicles. Fixes visual bug that showed creatures mounted on vehicle after being ejected.
This commit is contained in:
Machiavelli
2011-03-06 15:12:34 +01:00
parent 5be032fe79
commit d5be3353f3
3 changed files with 26 additions and 3 deletions
@@ -224,8 +224,16 @@ void TempSummon::SetTempSummonType(TempSummonType type)
m_type = type; m_type = type;
} }
void TempSummon::UnSummon() void TempSummon::UnSummon(uint32 msTime)
{ {
if (msTime)
{
ForcedUnsummonDelayEvent *pEvent = new ForcedUnsummonDelayEvent(*this);
m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime));
return;
}
//ASSERT(!isPet()); //ASSERT(!isPet());
if (isPet()) if (isPet())
{ {
@@ -241,6 +249,12 @@ void TempSummon::UnSummon()
AddObjectToRemoveList(); AddObjectToRemoveList();
} }
bool ForcedUnsummonDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
m_owner.UnSummon();
return true;
}
void TempSummon::RemoveFromWorld() void TempSummon::RemoveFromWorld()
{ {
if (!IsInWorld()) if (!IsInWorld())
@@ -29,7 +29,7 @@ class TempSummon : public Creature
void Update(uint32 time); void Update(uint32 time);
virtual void InitStats(uint32 lifetime); virtual void InitStats(uint32 lifetime);
virtual void InitSummon(); virtual void InitSummon();
void UnSummon(); void UnSummon(uint32 msTime = 0);
void RemoveFromWorld(); void RemoveFromWorld();
void SetTempSummonType(TempSummonType type); void SetTempSummonType(TempSummonType type);
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) {} void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) {}
@@ -97,5 +97,14 @@ class Puppet : public Minion
Player *m_owner; Player *m_owner;
}; };
class ForcedUnsummonDelayEvent : public BasicEvent
{
public:
ForcedUnsummonDelayEvent(TempSummon& owner) : BasicEvent(), m_owner(owner) { }
bool Execute(uint64 e_time, uint32 p_time);
private:
TempSummon& m_owner;
};
#endif #endif
+1 -1
View File
@@ -16711,7 +16711,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
setDeathState(JUST_DIED); setDeathState(JUST_DIED);
// If for other reason we as minion are exiting the vehicle (ejected, master unmounted) - unsummon // If for other reason we as minion are exiting the vehicle (ejected, master unmounted) - unsummon
else else
ToTempSummon()->UnSummon(); ToTempSummon()->UnSummon(2000); // Approximation
} }
} }