feat: add /reload command to re-initialize addon system

Add AddonManager::reload() which saves all SavedVariables, shuts down the
Lua VM, re-initializes it, rescans .toc files, and reloads all addons.
Wire /reload, /reloadui, /rl slash commands that call reload() and fire
VARIABLES_LOADED + PLAYER_LOGIN + PLAYER_ENTERING_WORLD lifecycle events.
Essential for addon development and troubleshooting.
This commit is contained in:
Kelsi 2026-03-20 16:17:04 -07:00
parent 23ebfc7e85
commit 21ead2aa4b
3 changed files with 51 additions and 0 deletions

View file

@ -27,9 +27,14 @@ public:
void saveAllSavedVariables();
/// Re-initialize the Lua VM and reload all addons (used by /reload).
bool reload();
private:
LuaEngine luaEngine_;
std::vector<TocFile> addons_;
game::GameHandler* gameHandler_ = nullptr;
std::string addonsPath_;
bool loadAddon(const TocFile& addon);
std::string getSavedVariablesPath(const TocFile& addon) const;