Skip to content

Conversation

Copy link

Copilot AI commented Jul 7, 2025

This PR implements the requested knife round feature for Best of 1 (BO1) matches and adds the ability to skip voting phases for direct match setup, addressing the core functionality requested in the issue.

Features Added

Knife Round Implementation

  • New configuration option: knife_round (boolean, default: false) enables knife rounds before match start
  • Complete state machine integration: Added KnifeRound and WaitingForKnifeRoundDecision states with proper transitions
  • Automatic knife round setup: Configures knife-only weapons, disables buy options, and sets appropriate round settings
  • Team decision system: Winning team can choose to !stay or !switch sides after knife round
  • G5 API integration: Sends knife_start and knife_won events for external systems
  • Server integration: Added SetupKnifeRound() method with proper CS2 console commands

Skip Veto Feature

  • New configuration option: skip_veto (boolean, default: false) bypasses map and team voting phases
  • Direct match flow: When enabled, goes straight from team definition to map switching
  • Maintains compatibility: Works with existing team modes and configurations

Enhanced Console Commands

The existing !stay and !switch commands now have dual functionality:

  • During team voting: Vote to stay with current team or switch to opposite team
  • After knife round: Vote to stay on current side or switch sides (only winning team can vote)

Configuration Examples

Basic knife round setup:

{
  "knife_round": true,
  "maplist": ["de_dust2"],
  "num_maps": 1
}

Quick match without voting:

{
  "skip_veto": true,
  "maplist": ["de_dust2"],
  "team1": { "players": {...} },
  "team2": { "players": {...} }
}

Combined knife round + no voting:

{
  "knife_round": true,
  "skip_veto": true,
  "maplist": ["de_dust2"]
}

Technical Implementation

State Machine Flow

MatchStarting → KnifeRound (if knife_round enabled)
KnifeRound → WaitingForKnifeRoundDecision (on round end)
WaitingForKnifeRoundDecision → MatchRunning (after team decision)

DefineTeams → SwitchMap (if skip_veto enabled, bypassing MapVote/TeamVote)

API Integration

  • Added KnifeRoundStartedParams and KnifeRoundWonParams classes
  • Extended IApiProvider with knife round event methods
  • Implemented support in G5ApiProvider, JsonApiProvider, and ApiStats

Backward Compatibility

  • All changes are opt-in via configuration flags
  • Existing matches without these options work exactly as before
  • Original test suite continues to pass

Testing

  • Added comprehensive unit tests for knife round flow
  • Added tests for skip veto functionality
  • All existing tests continue to pass
  • State machine transitions properly validated

Documentation

  • Updated configuration documentation with new options
  • Enhanced command documentation showing dual functionality
  • Added examples for common use cases

Fixes #340.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 127.0.0.11

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] FEATURE Request: Knife round Implement knife round feature and skip veto option for BO1 matches Jul 7, 2025
Copilot AI requested a review from MD-V July 7, 2025 08:48
Copilot finished work on behalf of MD-V July 7, 2025 08:48
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.

FEATURE Request: Knife round

2 participants