fix: add user feedback for ATTACKSWING_NOTSTANDING and CANT_ATTACK

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.
This commit is contained in:
Kelsi 2026-03-18 01:46:19 -07:00
parent 36158ae3e3
commit 1588c1029a

View file

@ -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);