Revert Visibility Notifier changes (#17682)

* Revert "fix(Core/Grid): Implement missing GridUnload setting (#17569)"

This reverts commit 79b39f9655.

* Revert "fix(Core/Grid): Address bugs and performance issues introduced by visibility notifier implementation (#17480)"

This reverts commit 60e27511c5.

* Revert "fix(Core): GridCleanUpDelay Log (#17436)"

This reverts commit 90b16ca065.

* Revert "feat(Core/Grids): Implement visibility notifier (#15919)"

This reverts commit 2779833768.
This commit is contained in:
Kitzunu
2023-11-12 00:48:49 +01:00
committed by GitHub
parent 4df0ab3427
commit bbadc32bea
64 changed files with 1074 additions and 1764 deletions

View File

@@ -301,6 +301,9 @@ void Creature::RemoveFromWorld()
if (m_formation)
sFormationMgr->RemoveCreatureFromGroup(m_formation, this);
if (Transport* transport = GetTransport())
transport->RemovePassenger(this, true);
Unit::RemoveFromWorld();
if (m_spawnId)
@@ -362,15 +365,17 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility)
//SaveRespawnTime();
}
float x, y, z, o;
GetRespawnPosition(x, y, z, &o);
SetHomePosition(x, y, z, o);
SetPosition(x, y, z, o);
// xinef: relocate notifier
m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
// pussywizard: if corpse was removed during falling then the falling will continue after respawn, so stop falling is such case
if (IsFalling())
StopMoving();
float x, y, z, o;
GetRespawnPosition(x, y, z, &o);
UpdateAllowedPositionZ(x, y, z);
SetHomePosition(x, y, z, o);
GetMap()->CreatureRelocation(this, x, y, z, o);
}
/**
@@ -1823,25 +1828,7 @@ void Creature::DeleteFromDB()
return;
}
CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId);
if (!data)
return;
CharacterDatabaseTransaction charTrans = CharacterDatabase.BeginTransaction();
sMapMgr->DoForAllMapsWithMapId(data->mapid,
[this, charTrans](Map* map) -> void
{
// despawn all active creatures, and remove their respawns
std::vector<Creature*> toUnload;
for (auto const& pair : Acore::Containers::MapEqualRange(map->GetCreatureBySpawnIdStore(), m_spawnId))
toUnload.push_back(pair.second);
for (Creature* creature : toUnload)
map->AddObjectToRemoveList(creature);
map->RemoveCreatureRespawnTime(m_spawnId);
}
);
GetMap()->RemoveCreatureRespawnTime(m_spawnId);
sObjectMgr->DeleteCreatureData(m_spawnId);
WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
@@ -2093,7 +2080,9 @@ void Creature::Respawn(bool force)
m_respawnedTime = GameTime::GetGameTime().count();
}
m_respawnedTime = GameTime::GetGameTime().count();
UpdateObjectVisibility();
// xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn)
m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
UpdateObjectVisibility(false);
}
void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer)
@@ -3075,7 +3064,10 @@ std::string const& Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const
void Creature::SetPosition(float x, float y, float z, float o)
{
UpdatePosition(x, y, z, o, false);
if (!Acore::IsValidMapCoord(x, y, z, o))
return;
GetMap()->CreatureRelocation(this, x, y, z, o);
}
bool Creature::IsDungeonBoss() const

View File

@@ -68,7 +68,6 @@ public:
void Update(uint32 time) override; // overwrited Unit::Update
void GetRespawnPosition(float& x, float& y, float& z, float* ori = nullptr, float* dist = nullptr) const;
bool IsSpawnedOnTransport() const { return m_creatureData && m_creatureData->mapid != GetMapId(); }
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
void SetCorpseRemoveTime(uint32 delay);