disable chat command, enable saving.

This commit is contained in:
Keleborn 2026-04-27 16:07:47 -07:00
parent 0698bb4e4c
commit 7adba305fb
2 changed files with 14 additions and 11 deletions

View File

@ -207,7 +207,7 @@ bool DebugAction::Execute(Event event)
endNode->setLinked(false); 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; return true;
} }
@ -231,7 +231,8 @@ bool DebugAction::Execute(Event event)
TravelNodeMap::instance().removeNode(startNode); 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; return true;
} }
@ -248,16 +249,17 @@ bool DebugAction::Execute(Event event)
node->removeLinkTo(path.first, true); node->removeLinkTo(path.first, true);
return 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..."); // Disabled: generateAll() touches Map / grid / mmap state that is only
std::thread([]() { TravelNodeMap::instance().generateAll(); }).detach(); // safe to mutate on the world thread. Running it from a detached worker
return true; // (or from a bot tick on a MapUpdater thread) races with world updates
} // and freezes the server. Use the console command instead, which runs
else if (text.find("gen path") != std::string::npos) // synchronously on the world thread:
{ // .playerbots travel generatenode
botAI->TellMasterNoFacing("Regenerating travel paths..."); botAI->TellMasterNoFacing(
std::thread([]() { TravelNodeMap::instance().generateAll(); }).detach(); "Disabled in chat. Run '.playerbots travel generatenode' from the server console.");
return true; return true;
} }
else if (text.find("crop path") != std::string::npos) else if (text.find("crop path") != std::string::npos)

View File

@ -1931,6 +1931,7 @@ void TravelNodeMap::generateAll()
LOG_INFO("playerbots", "[GenerateAll] Regenerating: {} nodes", nodes.size()); LOG_INFO("playerbots", "[GenerateAll] Regenerating: {} nodes", nodes.size());
generatePaths(false); generatePaths(false);
hasToSave = true;
saveNodeStore(); saveNodeStore();
BuildZoneIndex(); BuildZoneIndex();