From 1588c1029a6c1ea9f9ca1deda844521f524dbc31 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 18 Mar 2026 01:46:19 -0700 Subject: [PATCH] fix: add user feedback for ATTACKSWING_NOTSTANDING and CANT_ATTACK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both handlers silently cleared state with no visible message, leaving the player unsure why their attack failed. Split the shared case block: - NOTSTANDING: show "You need to stand up to fight." (rate-limited to 1.25s via the existing autoAttackRangeWarnCooldown_ guard), keep auto-attack active so it fires once the player stands. - CANT_ATTACK: call stopAutoAttack() to end the attack loop (target is a critter, civilian, or already dead — no point retrying), then show "You can't attack that." with the same rate limiter. --- src/game/game_handler.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 212fa601..6bce4ade 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -3248,9 +3248,21 @@ void GameHandler::handlePacket(network::Packet& packet) { } break; case Opcode::SMSG_ATTACKSWING_NOTSTANDING: - case Opcode::SMSG_ATTACKSWING_CANT_ATTACK: autoAttackOutOfRange_ = false; autoAttackOutOfRangeTime_ = 0.0f; + if (autoAttackRangeWarnCooldown_ <= 0.0f) { + addSystemChatMessage("You need to stand up to fight."); + autoAttackRangeWarnCooldown_ = 1.25f; + } + break; + case Opcode::SMSG_ATTACKSWING_CANT_ATTACK: + // Target is permanently non-attackable (critter, civilian, already dead, etc.). + // Stop the auto-attack loop so the client doesn't spam the server. + stopAutoAttack(); + if (autoAttackRangeWarnCooldown_ <= 0.0f) { + addSystemChatMessage("You can't attack that."); + autoAttackRangeWarnCooldown_ = 1.25f; + } break; case Opcode::SMSG_ATTACKERSTATEUPDATE: handleAttackerStateUpdate(packet);