Auto-unsheath weapons on combat engage

This commit is contained in:
Kelsi 2026-02-12 00:15:51 -08:00
parent 5d63bb0988
commit ef6be2f186
2 changed files with 12 additions and 0 deletions

View file

@ -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<float, std::milli>(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;