Bots: one .reload config reloads the bot settings, conf.d wins
`.playerbot reload` re-added playerbot.conf on top of the merged config. Any key in playerbot.conf then beat the same key in worldserver.conf.d (test runs set Playerbot.World.SoakAnchors, PlayerbotV2.SnapshotBuildSplitMap and the like there), so a test setting could vanish on reload. And `.reload config` alone did not refresh the module's cached settings, so a run needed both commands. - playerbot.conf is loaded as a base file: worldserver.conf.d overrides it, at startup and after every reload. - `.playerbot reload` reads every config file again in that order and takes the values; `.reload config` now also refreshes the module's settings (OnConfigLoad), so it is enough on its own. - after every load and reload the log, and the `.playerbot reload` reply, show the effective ParallelSnapshotBuild, SnapshotBuildSplitMap, World.Enable and World.SoakAnchors. Changes for a realm that has the same key in playerbot.conf and in worldserver.conf.d with different values: the conf.d value now wins.
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "Player.h"
|
||||
#include "PlayerbotMovement.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Services.h"
|
||||
#include "Util/ConfigReader.h" // Services::Config().refresh() on `.reload config`
|
||||
#include "SharedDefines.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellAuras.h"
|
||||
@@ -92,6 +94,15 @@ public:
|
||||
Module::instance().Shutdown();
|
||||
}
|
||||
|
||||
// `.reload config` has just read every config file again (playerbot.conf included): the module takes the new values too,
|
||||
// so one reload is enough for a bot setting in worldserver.conf.d.
|
||||
void OnConfigLoad(bool reload) override
|
||||
{
|
||||
if (!reload || !Playerbot::Services::Initialized())
|
||||
return;
|
||||
Playerbot::Services::Config().refresh();
|
||||
}
|
||||
|
||||
// A real player is about to take a place in a running battleground (a bot is leaving for them): no second instance
|
||||
// is opened for this queue meanwhile.
|
||||
bool CanCreateBattleground(uint32 battlemasterListId, uint8 bracketId) override
|
||||
|
||||
Reference in New Issue
Block a user