Skip to content

dods: implement tactical reload in TacticalMonitorTask#9

Open
petejefferson wants to merge 1 commit intocaxanga334:mainfrom
petejefferson:dods/tactical-reload
Open

dods: implement tactical reload in TacticalMonitorTask#9
petejefferson wants to merge 1 commit intocaxanga334:mainfrom
petejefferson:dods/tactical-reload

Conversation

@petejefferson
Copy link

Implements tactical reload behaviour for DoDS bots.

Previously, CDoDSBotTacticalMonitorTask::OnTaskUpdate() was empty,
so bots would never reload unless forced to by the game engine (i.e.
empty clip mid-combat). This caused bots to enter engagements with
partially-spent magazines.

Changes

  • dodsbot_tactical_monitor_task.h: add CountdownTimer m_reloadCheckTimer
    to throttle the reload check to once per second.

  • dodsbot_tactical_monitor_task.cpp:

    • Add static bool NeedsReload(const CDoDSBotWeapon*, const CBaseBot*)
      helper that correctly handles:
      • Weapons with no clip (reserve-only ammo pools) — skipped, pressing
        reload does nothing for these.
      • Empty reserve — no point reloading if there is nothing to top up with.
      • Partial clip — reads m_iMaxClip1 via Prop_Data to detect whether
        the clip is below maximum capacity. Falls back to empty-only reload
        if the property cannot be read.
    • Implement OnTaskUpdate(): once per second, if no enemy has been visible
      in the last 5 seconds, call PressReloadButton() when NeedsReload()
      returns true.

The 5-second visibility window mirrors the rcbot2 reference implementation
(m_fLastSeeEnemy + 5.0f).

@petejefferson petejefferson force-pushed the dods/tactical-reload branch from 550764a to 31c6d98 Compare March 8, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant