[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
3 changed files with 16 additions and 38 deletions
+16 -25
View File
@@ -491,42 +491,33 @@ void EntityList::MobProcess()
old_client_count > 0 &&
zone->GetSecondsBeforeIdle() > 0
) {
if (!zone->IsIdle()) {
LogInfo(
"Zone will go into an idle state after [{}] second{}.",
zone->GetSecondsBeforeIdle(),
zone->GetSecondsBeforeIdle() != 1 ? "s" : ""
);
}
LogInfo(
"Zone will go into an idle state after [{}] second{}.",
zone->GetSecondsBeforeIdle(),
zone->GetSecondsBeforeIdle() != 1 ? "s" : ""
);
mob_settle_timer->Start(zone->GetSecondsBeforeIdle() * 1000);
}
old_client_count = numclients;
if (numclients == 0 && mob_settle_timer->Check()) {
if (!zone->IsIdle()) {
LogInfo(
"Zone has gone idle after [{}] second{}.",
zone->GetSecondsBeforeIdle(),
zone->GetSecondsBeforeIdle() != 1 ? "s" : ""
);
zone->SetIsIdle(true);
}
LogInfo(
"Zone has gone idle after [{}] second{}.",
zone->GetSecondsBeforeIdle(),
zone->GetSecondsBeforeIdle() != 1 ? "s" : ""
);
mob_settle_timer->Disable();
}
// Disable settle timer if someone zones into empty zone
if (numclients > 0 || mob_settle_timer->Check()) {
if (zone->IsIdle()) {
LogInfo("Zone is no longer idle.");
zone->SetIsIdle(false);
if (mob_settle_timer->Enabled()) {
LogInfo("Zone is no longer scheduled to go idle.");
mob_settle_timer->Disable();
}
mob_settle_timer->Disable();
}
old_client_count = numclients;
Spawn2* s2 = mob->CastToNPC()->respawn2;
// Perform normal mob processing if any of these are true: