Register connected altbots missing intents in the follow loop
Connected altbots whose AI was never attached by OnPlayerLogin (stale core hook or is_bot false at login time) never got has_intents, so the companion loop skipped them forever. Late-register them idempotently on the next companion tick so they can follow without a relog.
This commit is contained in:
@@ -1222,6 +1222,25 @@ void Module::OnWorldUpdate(std::chrono::milliseconds diff)
|
||||
|
||||
for (BotId const botId : alts)
|
||||
{
|
||||
if (!Services::Registry().has(botId))
|
||||
{
|
||||
Player* hbot = ObjectAccessor::FindConnectedPlayer(
|
||||
ObjectGuid::Create<HighGuid::Player>(botId));
|
||||
if (hbot)
|
||||
{
|
||||
BotPersonality personality =
|
||||
Services::Config().random_personality()
|
||||
? RandomPersonality(SeedForBot(botId))
|
||||
: DefaultPersonality();
|
||||
Services::Registry().register_bot(
|
||||
botId, personality, BotRng{SeedForBot(botId)});
|
||||
Services::Scheduler().register_bot(botId, ActivityTier::Idle);
|
||||
TC_LOG_INFO("playerbot.v2",
|
||||
"[AltFollow] {} late-registered connected altbot "
|
||||
"(no intents), follow resumes next tick",
|
||||
hbot->GetName());
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (levelSyncDone < 3)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user