fix(Core/Maps): Move corpse expiration updates to map (#22780)

This commit is contained in:
Takenbacon
2025-09-03 16:29:15 -07:00
committed by GitHub
parent fa9e34de88
commit af31aaa374
6 changed files with 24 additions and 24 deletions

View File

@@ -73,6 +73,8 @@ Map::Map(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent) :
//lets initialize visibility distance for map
Map::InitVisibilityDistance();
_corpseUpdateTimer.SetInterval(20 * MINUTE * IN_MILLISECONDS);
}
// Hook called after map is created AND after added to map list
@@ -494,6 +496,8 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
HandleDelayedVisibility();
UpdateExpiredCorpses(t_diff);
sScriptMgr->OnMapUpdate(this, t_diff);
METRIC_VALUE("map_creatures", uint64(GetObjectsStore().Size<Creature>()),
@@ -1580,6 +1584,17 @@ void Map::SendInitSelf(Player* player)
player->SendDirectMessage(&packet);
}
void Map::UpdateExpiredCorpses(uint32 const diff)
{
_corpseUpdateTimer.Update(diff);
if (!_corpseUpdateTimer.Passed())
return;
RemoveOldCorpses();
_corpseUpdateTimer.Reset();
}
void Map::SendInitTransports(Player* player)
{
if (_transports.empty())

View File

@@ -443,6 +443,8 @@ public:
void SendZoneDynamicInfo(Player* player);
void SendInitSelf(Player* player);
void UpdateExpiredCorpses(uint32 const diff);
void PlayDirectSoundToMap(uint32 soundId, uint32 zoneId = 0);
void SetZoneMusic(uint32 zoneId, uint32 musicId);
void SetZoneWeather(uint32 zoneId, WeatherState weatherId, float weatherGrade);
@@ -576,6 +578,8 @@ private:
ZoneDynamicInfoMap _zoneDynamicInfo;
uint32 _defaultLight;
IntervalTimer _corpseUpdateTimer;
template<HighGuid high>
inline ObjectGuidGeneratorBase& GetGuidSequenceGenerator()
{