diff --git a/include/core/application.hpp b/include/core/application.hpp index 143ba8a3..67482afa 100644 --- a/include/core/application.hpp +++ b/include/core/application.hpp @@ -192,6 +192,7 @@ private: uint32_t mountModelId_ = 0; uint32_t pendingMountDisplayId_ = 0; // Deferred mount load (0 = none pending) bool weaponsSheathed_ = false; + bool wasAutoAttacking_ = false; void processPendingMount(); bool creatureLookupsBuilt_ = false; diff --git a/src/core/application.cpp b/src/core/application.cpp index 36043c15..f29d91db 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -352,6 +352,7 @@ void Application::logoutToLogin() { npcsSpawned = false; playerCharacterSpawned = false; weaponsSheathed_ = false; + wasAutoAttacking_ = false; world.reset(); if (renderer) { // Remove old player model so it doesn't persist into next session @@ -409,6 +410,16 @@ void Application::update(float deltaTime) { auto gh2 = std::chrono::high_resolution_clock::now(); ghTime += std::chrono::duration(gh2 - gh1).count(); + // Always unsheath on combat engage. + if (gameHandler) { + const bool autoAttacking = gameHandler->isAutoAttacking(); + if (autoAttacking && !wasAutoAttacking_ && weaponsSheathed_) { + weaponsSheathed_ = false; + loadEquippedWeapons(); + } + wasAutoAttacking_ = autoAttacking; + } + // Toggle weapon sheathe state with Z (ignored while UI captures keyboard). { const bool uiWantsKeyboard = ImGui::GetIO().WantCaptureKeyboard;