Add /logout chat command

This commit is contained in:
Kelsi 2026-02-05 15:59:06 -08:00
parent 117bbad9ff
commit 66f78bb192
3 changed files with 25 additions and 0 deletions

View file

@ -19,6 +19,7 @@
#include "rendering/wmo_renderer.hpp"
#include "rendering/minimap.hpp"
#include "rendering/loading_screen.hpp"
#include "audio/music_manager.hpp"
#include <imgui.h>
#include "pipeline/m2_loader.hpp"
#include "pipeline/wmo_loader.hpp"
@ -346,6 +347,23 @@ void Application::setState(AppState newState) {
}
}
void Application::logoutToLogin() {
LOG_INFO("Logout requested");
if (gameHandler) {
gameHandler->disconnect();
gameHandler->setSinglePlayerMode(false);
}
singlePlayerMode = false;
npcsSpawned = false;
world.reset();
if (renderer) {
if (auto* music = renderer->getMusicManager()) {
music->stopMusic(0.0f);
}
}
setState(AppState::AUTHENTICATION);
}
void Application::update(float deltaTime) {
// Update based on current state
switch (state) {