From 7adba305fb659445977dff0b9ae037b6372fd396 Mon Sep 17 00:00:00 2001 From: Keleborn <22352763+Celandriel@users.noreply.github.com> Date: Mon, 27 Apr 2026 16:07:47 -0700 Subject: [PATCH] disable chat command, enable saving. --- src/Ai/Base/Actions/DebugAction.cpp | 24 +++++++++++++----------- src/Mgr/Travel/TravelNode.cpp | 1 + 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Ai/Base/Actions/DebugAction.cpp b/src/Ai/Base/Actions/DebugAction.cpp index d343396b8..39a66bfe6 100644 --- a/src/Ai/Base/Actions/DebugAction.cpp +++ b/src/Ai/Base/Actions/DebugAction.cpp @@ -207,7 +207,7 @@ bool DebugAction::Execute(Event event) endNode->setLinked(false); } - botAI->TellMasterNoFacing("Node " + name + " created. Run 'gen path' when done adding nodes."); + botAI->TellMasterNoFacing("Node " + name + " created. Use console command '.playerbots travel generatenode' to connect nodes."); return true; } @@ -231,7 +231,8 @@ bool DebugAction::Execute(Event event) TravelNodeMap::instance().removeNode(startNode); } - botAI->TellMasterNoFacing("Node removed. Run 'gen path' when done editing nodes."); + botAI->TellMasterNoFacing("Node removed. Use console command '.playerbots travel generatenode' to finalize nodes."); + return true; } @@ -248,16 +249,17 @@ bool DebugAction::Execute(Event event) node->removeLinkTo(path.first, true); return true; } - else if (text.find("gen node") != std::string::npos) + else if (text.find("gen node") != std::string::npos || + text.find("gen path") != std::string::npos) { - botAI->TellMasterNoFacing("Regenerating travel nodes..."); - std::thread([]() { TravelNodeMap::instance().generateAll(); }).detach(); - return true; - } - else if (text.find("gen path") != std::string::npos) - { - botAI->TellMasterNoFacing("Regenerating travel paths..."); - std::thread([]() { TravelNodeMap::instance().generateAll(); }).detach(); + // Disabled: generateAll() touches Map / grid / mmap state that is only + // safe to mutate on the world thread. Running it from a detached worker + // (or from a bot tick on a MapUpdater thread) races with world updates + // and freezes the server. Use the console command instead, which runs + // synchronously on the world thread: + // .playerbots travel generatenode + botAI->TellMasterNoFacing( + "Disabled in chat. Run '.playerbots travel generatenode' from the server console."); return true; } else if (text.find("crop path") != std::string::npos) diff --git a/src/Mgr/Travel/TravelNode.cpp b/src/Mgr/Travel/TravelNode.cpp index a3c97fb65..878668674 100644 --- a/src/Mgr/Travel/TravelNode.cpp +++ b/src/Mgr/Travel/TravelNode.cpp @@ -1931,6 +1931,7 @@ void TravelNodeMap::generateAll() LOG_INFO("playerbots", "[GenerateAll] Regenerating: {} nodes", nodes.size()); generatePaths(false); + hasToSave = true; saveNodeStore(); BuildZoneIndex();