Skip to content

Weapon-slot wield timeout when BB's own lock blocks the swap #101

Description

@hummat

Symptom

In console-2026-04-17-13.37.34, both fallback paths logged wield-timeout aborts:

  • grenade_fallback.lua — 3× grenade wield timeout, resetting with retry (lines 2346, 2654, 3366)
  • item_fallback.lua — 1× fallback item blocked zealot_relic (wield timeout) (line 5408)

All four happened during active ability-sequence windows on another bot or the same bot, where BB's own weapon_action.bot_queue_action_input hook rejected the foreign wield input.

Root cause

weapon_action.lua:526-557 intentionally blocks foreign wield raw-inputs while an ability sequence is holding the slot:

"blocked weapon switch while keeping psyker_smite sequence (raw_input=wield_1)"
"blocked foreign weapon action shoot_pressed while keeping zealot_throwing_knives wield"

grenade_fallback.lua:855 and item_fallback.lua:591 then wait out the full WIELD_TIMEOUT_S (2.0s / 1.5s) before aborting + RETRY_COOLDOWN_S (2.0s). Total wasted window per event: ~3.5–4.0s per bot.

Impact

  • One zealot_relic consume lost in the observed run (user-visible).
  • Retry path recovers grenade throws, but at ~4s cost.
  • Pattern likely scales in high-ability-density runs (Auric, multiple blitz-class bots).

Proposal

Short-circuit wield timeout when BB's own lock is the cause:

  1. Expose weapon_action.is_slot_locked(unit) (or similar) reporting the current lock-owner ability + slot.
  2. In grenade_fallback._advance_wield_stage and item_fallback waiting_wield state, if the target slot is locked by a different sequence, abort immediately with reason = 'slot_locked' and schedule a shorter cooldown (e.g. poll for lock release).
  3. Alternative: lengthen timeouts? No — 2s is already generous; the problem is wasted idle time, not short patience.

Acceptance criteria

  • Event log blocked events with reason = 'slot_locked' distinguishable from reason = 'wield_timeout'.
  • Post-lock retry latency drops from ~4s to ~0.5s when lock clears.
  • No regression in normal wield timeout behavior (unrelated slow wield animations still time out correctly).

References

  • scripts/mods/BetterBots/weapon_action.lua:526-557 — lock logic
  • scripts/mods/BetterBots/grenade_fallback.lua:855-865 — wield timeout branch
  • scripts/mods/BetterBots/item_fallback.lua:589-604 — item wield timeout branch
  • Log: console-2026-04-17-13.37.34-85c41df2-003b-47e0-9968-bb5549610d5f.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3: backlogNice to have, no timelinearea: bot-behaviorGeneral bot behavior beyond ability activationbugSomething isn't workingneeds-testingImplemented, awaiting in-game verification

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions