Feat: Alliance and betrayal hotkeys (#3110)

Original Feature request by @FloPinguin  
Resolves #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:
<img width="739" height="595" alt="image"
src="https://github.com/user-attachments/assets/ee958eab-fd50-4971-85c5-dfd49c6f0bdc"
/>
In game logs:
<img width="373" height="232" alt="image"
src="https://github.com/user-attachments/assets/2cf6bb07-5f0d-425a-82d3-65a44fef99c5"
/>

## Please complete the following:

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


Discord username:
_Dave9595_
This commit is contained in:
Jarifa
2026-04-21 23:34:51 +02:00
committed by GitHub
parent eedb90ffb5
commit 0801798fbd
6 changed files with 132 additions and 1 deletions
+26
View File
@@ -657,6 +657,32 @@ export class UserSettingModal extends BaseModal {
@change=${this.handleKeybindChange}
></setting-keybind>
<h2
class="text-blue-200 text-xl font-bold mt-8 mb-3 border-b border-white/10 pb-2"
>
${translateText("user_setting.ally_keybinds")}
</h2>
<setting-keybind
action="requestAlliance"
label=${translateText("user_setting.request_alliance")}
description=${translateText("user_setting.request_alliance_desc")}
defaultKey="KeyK"
.value=${this.getKeyValue("requestAlliance")}
.display=${this.getKeyChar("requestAlliance")}
@change=${this.handleKeybindChange}
></setting-keybind>
<setting-keybind
action="breakAlliance"
label=${translateText("user_setting.break_alliance")}
description=${translateText("user_setting.break_alliance_desc")}
defaultKey="KeyL"
.value=${this.getKeyValue("breakAlliance")}
.display=${this.getKeyChar("breakAlliance")}
@change=${this.handleKeybindChange}
></setting-keybind>
<h2
class="text-blue-200 text-xl font-bold mt-8 mb-3 border-b border-white/10 pb-2"
>