[Bug Fix] Fixes to zone idle while empty changes. (#4006)

This commit is contained in:
Paul Coene 2024-01-22 19:33:00 -05:00 committed by GitHub
parent 26769f40d9
commit 7fed8fc8c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 38 deletions

View File

@ -491,41 +491,32 @@ void EntityList::MobProcess()
old_client_count > 0 && old_client_count > 0 &&
zone->GetSecondsBeforeIdle() > 0 zone->GetSecondsBeforeIdle() > 0
) { ) {
if (!zone->IsIdle()) {
LogInfo( LogInfo(
"Zone will go into an idle state after [{}] second{}.", "Zone will go into an idle state after [{}] second{}.",
zone->GetSecondsBeforeIdle(), zone->GetSecondsBeforeIdle(),
zone->GetSecondsBeforeIdle() != 1 ? "s" : "" zone->GetSecondsBeforeIdle() != 1 ? "s" : ""
); );
}
mob_settle_timer->Start(zone->GetSecondsBeforeIdle() * 1000); mob_settle_timer->Start(zone->GetSecondsBeforeIdle() * 1000);
} }
old_client_count = numclients;
if (numclients == 0 && mob_settle_timer->Check()) { if (numclients == 0 && mob_settle_timer->Check()) {
if (!zone->IsIdle()) {
LogInfo( LogInfo(
"Zone has gone idle after [{}] second{}.", "Zone has gone idle after [{}] second{}.",
zone->GetSecondsBeforeIdle(), zone->GetSecondsBeforeIdle(),
zone->GetSecondsBeforeIdle() != 1 ? "s" : "" zone->GetSecondsBeforeIdle() != 1 ? "s" : ""
); );
mob_settle_timer->Disable();
zone->SetIsIdle(true);
}
} }
// Disable settle timer if someone zones into empty zone // Disable settle timer if someone zones into empty zone
if (numclients > 0 || mob_settle_timer->Check()) { if (numclients > 0 || mob_settle_timer->Check()) {
if (zone->IsIdle()) { if (mob_settle_timer->Enabled()) {
LogInfo("Zone is no longer idle."); LogInfo("Zone is no longer scheduled to go idle.");
zone->SetIsIdle(false);
}
mob_settle_timer->Disable(); mob_settle_timer->Disable();
} }
}
old_client_count = numclients;
Spawn2* s2 = mob->CastToNPC()->respawn2; Spawn2* s2 = mob->CastToNPC()->respawn2;

View File

@ -3259,13 +3259,3 @@ void Zone::SetSecondsBeforeIdle(uint32 seconds_before_idle)
{ {
Zone::m_seconds_before_idle = seconds_before_idle; Zone::m_seconds_before_idle = seconds_before_idle;
} }
bool Zone::IsIdle() const
{
return m_is_idle;
}
void Zone::SetIsIdle(bool m_is_idle)
{
Zone::m_is_idle = m_is_idle;
}

View File

@ -105,8 +105,6 @@ public:
AA::Ability *GetAlternateAdvancementAbilityByRank(int rank_id); AA::Ability *GetAlternateAdvancementAbilityByRank(int rank_id);
AA::Rank *GetAlternateAdvancementRank(int rank_id); AA::Rank *GetAlternateAdvancementRank(int rank_id);
bool is_zone_time_localized; bool is_zone_time_localized;
bool IsIdle() const;
void SetIsIdle(bool m_is_idle);
bool IsIdleWhenEmpty() const; bool IsIdleWhenEmpty() const;
void SetIdleWhenEmpty(bool idle_when_empty); void SetIdleWhenEmpty(bool idle_when_empty);
uint32 GetSecondsBeforeIdle() const; uint32 GetSecondsBeforeIdle() const;
@ -443,7 +441,6 @@ private:
uint32 m_last_ucss_update; uint32 m_last_ucss_update;
bool m_idle_when_empty; bool m_idle_when_empty;
uint32 m_seconds_before_idle; uint32 m_seconds_before_idle;
bool m_is_idle;
GlobalLootManager m_global_loot; GlobalLootManager m_global_loot;
LinkedList<ZoneClientAuth_Struct *> client_auth_list; LinkedList<ZoneClientAuth_Struct *> client_auth_list;