Skip to content

Conversation

@Jarifa
Copy link

@Jarifa Jarifa commented Feb 3, 2026

Original Feature request by @FloPinguin #3077

Description:

Adds hotkeys for Requesting alliances and breaking alliances. This allows for players to send or break alliances whose tile is under the cursor, without opening the radial menu.

Keybinds:
New "Ally Keybinds" section in Settings -> Keybinds
Request alliance: Default: K - sends an alliance request to the player/bot/nation under the cursor
Break alliance: Default: L - breaks the alliance with the player at the cursor

Behavior:

  • Cursor must be over a tile owned by the target player. The action runs only when the game allows it, following the same logic as the radial menu. (canSendAllianceRequest and canBreakAlliance)
  • When an alliance request is sent, the events log shows: "Alliance request sent to [target]" for confirmation. No extra message for breaking an alliance (betrayal/debuff message already exists and is sent upon breaking an alliance)

Screenshots:

Keybind menu:
image
In game logs:
image

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Discord username:
Dave9595

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

Walkthrough

Adds alliance request and break-alliance actions: new keybinds, input events, client handlers that validate target ownership and permissions, intent events emitted, event display logging, and localization/UI entries for the new strings and keybinds.

Changes

Cohort / File(s) Summary
Localization
resources/lang/en.json
Added keys for ally keybinds and event text: ally_keybinds, request_alliance, request_alliance_desc, break_alliance, break_alliance_desc, alliance_request_sent.
Input events & keybind UI
src/client/InputHandler.ts, src/client/UserSettingModal.ts
Introduced DoRequestAllianceEvent and DoBreakAllianceEvent; added keybinds (KeyK, KeyL) and corresponding UI blocks in user settings.
Client handlers
src/client/ClientGameRunner.ts
Registered listeners for request/break events; added private handlers that resolve cursor tile, verify owner is a player, check permissions, and emit SendAllianceRequestIntentEvent or SendBreakAllianceIntentEvent.
Event display
src/client/graphics/layers/EventsDisplay.ts
Subscribed to alliance intent events and appends an ALLIANCE_REQUEST event when current player sent a request, using recipient name and current game tick.

Sequence Diagram

sequenceDiagram
    participant Player as Player (Input)
    participant InputHandler as InputHandler
    participant Runner as ClientGameRunner
    participant Intents as Intent Events
    participant EventsDisplay as EventsDisplay

    Player->>InputHandler: Press K (request) or L (break)
    InputHandler->>InputHandler: Emit DoRequestAllianceEvent / DoBreakAllianceEvent
    InputHandler->>Runner: Dispatch DoRequestAllianceEvent / DoBreakAllianceEvent
    Runner->>Runner: Resolve tile under cursor
    Runner->>Runner: Verify tile owner is a player
    Runner->>Runner: Check canSendAllianceRequest / canBreakAlliance
    Runner->>Intents: Emit SendAllianceRequestIntentEvent / SendBreakAllianceIntentEvent
    Intents->>EventsDisplay: Intent event received
    EventsDisplay->>EventsDisplay: Append ALLIANCE_REQUEST event (with recipient, tick)
    EventsDisplay->>Player: Display confirmation message
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

Two keys tap, a treaty starts,
K to ask with hopeful hearts,
L to end the whispered pact,
Events record each gentle act,
Lines and keys connect the parts.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Feat: Alliance and betrayal hotkeys' clearly and concisely summarizes the main feature being added—new keyboard shortcuts for alliance management.
Description check ✅ Passed The description is directly related to the changeset, detailing the new alliance/betrayal hotkeys, their default keybinds, behavior, and user-facing confirmations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 3, 2026
@CLAassistant
Copy link

CLAassistant commented Feb 3, 2026

CLA assistant check
All committers have signed the CLA.

@evanpelle
Copy link
Collaborator

please run npm run format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

3 participants