mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 23:26:23 +00:00
feat(Core/Grids): Implement visibility notifier (#15919)
* Cherry-picked from TrinityCore (unable to find author)
This commit is contained in:
@@ -26,6 +26,35 @@
|
||||
#include "Transport.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
void ObjectGridEvacuator::Visit(CreatureMapType& m)
|
||||
{
|
||||
// creature in unloading grid can have respawn point in another grid
|
||||
// if it will be unloaded then it will not respawn in original grid until unload/load original grid
|
||||
// move to respawn point to prevent this case. For player view in respawn grid this will be normal respawn.
|
||||
for (CreatureMapType::iterator iter = m.begin(); iter != m.end();)
|
||||
{
|
||||
Creature* c = iter->GetSource();
|
||||
++iter;
|
||||
|
||||
ASSERT(!c->IsPet() && "ObjectGridRespawnMover must not be called for pets");
|
||||
c->GetMap()->CreatureRespawnRelocation(c, true);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectGridEvacuator::Visit(GameObjectMapType& m)
|
||||
{
|
||||
// gameobject in unloading grid can have respawn point in another grid
|
||||
// if it will be unloaded then it will not respawn in original grid until unload/load original grid
|
||||
// move to respawn point to prevent this case. For player view in respawn grid this will be normal respawn.
|
||||
for (GameObjectMapType::iterator iter = m.begin(); iter != m.end();)
|
||||
{
|
||||
GameObject* go = iter->GetSource();
|
||||
++iter;
|
||||
|
||||
go->GetMap()->GameObjectRespawnRelocation(go, true);
|
||||
}
|
||||
}
|
||||
|
||||
// for loading world object at grid loading (Corpses)
|
||||
//TODO: to implement npc on transport, also need to load npcs at grid loading
|
||||
class ObjectWorldLoader
|
||||
@@ -229,6 +258,17 @@ void ObjectGridUnloader::Visit(GridRefMgr<T>& m)
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectGridStoper::Visit(CreatureMapType& m)
|
||||
{
|
||||
// stop any fights at grid de-activation and remove dynobjects created at cast by creatures
|
||||
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
iter->GetSource()->RemoveAllDynObjects();
|
||||
if (iter->GetSource()->IsInCombat())
|
||||
iter->GetSource()->CombatStop();
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void ObjectGridCleaner::Visit(GridRefMgr<T>& m)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user