From 3cec1cf129b183cb6101e310cc0d4b5fe2e7bbe1 Mon Sep 17 00:00:00 2001 From: sruon Date: Mon, 19 Jan 2026 08:37:25 -0700 Subject: [PATCH 1/2] Persist spawn timers during zone sleep --- src/map/zone.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/map/zone.cpp b/src/map/zone.cpp index 0ceb56b0dac..971555650c1 100644 --- a/src/map/zone.cpp +++ b/src/map/zone.cpp @@ -846,12 +846,6 @@ void CZone::ZoneServer(timer::time_point tick) ZoneTimerTriggerAreas->m_type = CTaskManager::TASK_REMOVE; ZoneTimerTriggerAreas = nullptr; - - if (SpawnHandlerTimer) - { - SpawnHandlerTimer->m_type = CTaskManager::TASK_REMOVE; - SpawnHandlerTimer = nullptr; - } } } @@ -960,14 +954,16 @@ void CZone::createZoneTimers() return 0; }); - SpawnHandlerTimer = CTaskManager::getInstance()->AddTask(m_zoneName + "_SpawnHandler", timer::now(), this, CTaskManager::TASK_INTERVAL, kSpawnHandlerInterval, - [](const timer::time_point tick, const CTaskManager::CTask* PTask) + if (!SpawnHandlerTimer) { - const auto* PZone = std::any_cast(PTask->m_data); - PZone->spawnHandler()->Tick(tick); - return 0; - }); - // clang-format on + SpawnHandlerTimer = CTaskManager::getInstance()->AddTask(m_zoneName + "_SpawnHandler", timer::now(), this, CTaskManager::TASK_INTERVAL, kSpawnHandlerInterval, + [](const timer::time_point tick, const CTaskManager::CTask* PTask) + { + const auto* PZone = std::any_cast(PTask->m_data); + PZone->spawnHandler()->Tick(tick); + return 0; + }); + } } void CZone::CharZoneIn(CCharEntity* PChar) From 8c7dc2f4fc11071594bd8a91f28a80f601e4528d Mon Sep 17 00:00:00 2001 From: sruon Date: Mon, 19 Jan 2026 09:57:27 -0700 Subject: [PATCH 2/2] Create spawn task on zone instantiation --- src/map/spawn_handler.cpp | 15 +++++++++++++++ src/map/spawn_handler.h | 1 + src/map/utils/zoneutils.cpp | 12 +++++++++--- src/map/zone.cpp | 18 +++++++----------- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/map/spawn_handler.cpp b/src/map/spawn_handler.cpp index 54b3ea88d6e..bbcd5e1c827 100644 --- a/src/map/spawn_handler.cpp +++ b/src/map/spawn_handler.cpp @@ -58,6 +58,21 @@ void SpawnHandler::registerForRespawn(CMobEntity* PMob, const std::optional