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:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user