Skip to content

Reapply music kits when a bot joins mid-round - #12

Closed
xiaoyueyoqwq wants to merge 2 commits into
Ayrton09:mainfrom
xiaoyueyoqwq:fix/music-kit-bot-team-cues
Closed

xiaoyueyoqwq wants to merge 2 commits into
Ayrton09:mainfrom
xiaoyueyoqwq:fix/music-kit-bot-team-cues

Conversation

@xiaoyueyoqwq

Copy link
Copy Markdown
Contributor

Stacked on #11. Review the last commit; the flag commit is that PR.

bot_add mid-round resets every human kit. Victory and the next wait cue sample before the 1s reconcile. A Pre write on player_team still matches (inventory MusicID is still the selected kit) and is skipped; Valve then writes MusicID to 1 on the next frame.

What this PR does

  • Reapply on bot team-join (player_team Pre) and on the following frame.
  • Reapply on bot spawn, plus one 0.25s settle after the bot events.
  • Reapply on round_prestart and on the following frame (MusicKitID is cleared there).

No extra round-event timer shotgun. No version string change. ModuleVersion stays 1.0.12.

Depends on

#11 (m_pInventoryServices dirty). Merge that first; this PR then only contains the bot-timing commit.

Validation: dotnet build -c Release — 0 warnings, 0 errors.

Wait/intro cues read m_unMusicID on the inventory component. Writing
MusicID without dirtying that pointer leaves the value server-side, and
the 1s reconcile then sees a match and skips. Only fields that changed
are written so repeated apply/reconcile calls do not resend.
Valve resets every human kit on bot_add. Inventory MusicID is rewritten
to 1 on the next frame after the bot joins a team, so the Pre write
still matches and is skipped. Write on bot team-join (Pre), on that
next frame, on bot spawn, and on round_prestart plus its next frame.
One 0.25s settle after the bot events; no extra round-event timer shotgun.
@Ayrton09

Ayrton09 commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Closing this one, but the diagnosis is credited in the 1.0.13 notes. Instead of the per-event writes, the music reconcile now runs every tick (it was already doing the compare, and with #11 the write side is cheap), so a bot joining or spawning, the round boundary, or anything else that resets a player's kit is corrected on the next tick without guessing which event to hook. That also let me drop the bot spawn and map start timers.

@Ayrton09 Ayrton09 closed this Sep 6, 2026
@xiaoyueyoqwq

Copy link
Copy Markdown
Contributor Author

Closing this one, but the diagnosis is credited in the 1.0.13 notes. Instead of the per-event writes, the music reconcile now runs every tick (it was already doing the compare, and with #11 the write side is cheap), so a bot joining or spawning, the round boundary, or anything else that resets a player's kit is corrected on the next tick without guessing which event to hook. That also let me drop the bot spawn and map start timers.

Verification successful; the solution is impressive—great work!

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.

2 participants