Skip to content

Add alliance renewal action to Radial Menu#3095

Draft
deshack wants to merge 2 commits intoopenfrontio:mainfrom
deshack:feature/alliance-extend-radial-menu
Draft

Add alliance renewal action to Radial Menu#3095
deshack wants to merge 2 commits intoopenfrontio:mainfrom
deshack:feature/alliance-extend-radial-menu

Conversation

@deshack
Copy link
Contributor

@deshack deshack commented Feb 2, 2026

Description:

The following PR replaces the (disabled) alliance request button with an alliance extension/renewal button when the alliance with the target player is expiring.

The extend button is hidden after the player agrees to renew.

Asking for comments/guidance regarding icon and color.

image

Still WIP, we need to remove the renewal message from the EventsDisplay upon agreement via Radial Menu.

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

Please put your Discord username so you can be contacted if a bug or regression is found:

deshack_82603

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 2, 2026

Walkthrough

This pull request adds alliance extension capability to the game. It introduces validation methods to check extension eligibility, updates the radial menu UI to display the extension option conditionally, creates event handlers to emit extension intents, and adds necessary interface signatures across the core game logic and client layers.

Changes

Cohort / File(s) Summary
Client Event Handler
src/client/graphics/layers/PlayerActionHandler.ts
Added handleExtendAlliance method that emits SendAllianceExtensionIntentEvent for alliance extension actions.
Radial Menu UI
src/client/graphics/layers/RadialMenuElements.ts
Added allyExtendElement menu item that displays conditionally based on canExtendAlliance flag. Updated root menu construction logic to show extend option when eligible.
Game Interface Definitions
src/core/game/Game.ts
Extended public API with agreedToExtend method on MutableAlliance, canExtendAlliance method on Player, and canExtendAlliance property on PlayerInteraction.
Core Game Logic
src/core/game/PlayerImpl.ts, src/core/game/AllianceImpl.ts
Implemented alliance extension eligibility checks: PlayerImpl.canExtendAlliance validates both players are alive, allied, and in extension window; AllianceImpl.agreedToExtend checks if player has agreed to extend.
Game Runner
src/core/GameRunner.ts
Integrated canExtendAlliance capability into player interaction data by computing the capability for each player pair and exposing it in the PlayerActions interface.

Sequence Diagram

sequenceDiagram
    participant UI as Radial Menu
    participant Handler as PlayerActionHandler
    participant Game as GameRunner
    participant Player as PlayerImpl
    participant Alliance as AllianceImpl
    participant Events as Event System

    UI->>Player: canExtendAlliance(other)
    Player->>Alliance: allianceWith(other)
    Player->>Alliance: expiresAt()
    Player->>Player: Validate: alive, allied, in window
    Player-->>UI: canExtendAlliance: boolean

    UI->>UI: Show extend element if canExtendAlliance
    UI->>Handler: handleExtendAlliance(recipient)
    Handler->>Events: Emit SendAllianceExtensionIntentEvent
    Events->>Game: Process event
    Game->>Alliance: agreedToExtend(player)
    Alliance-->>Game: Agreement status
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🤝 Alliances now stretch and grow,
No need to part when bonds still glow,
A menu click, an event flows,
Extension granted where friendship goes! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add alliance renewal action to Radial Menu' clearly and specifically summarizes the main change: adding an alliance renewal/extension button to the radial menu interface.
Description check ✅ Passed The description is directly related to the changeset, explaining what is being added (alliance extension button), when it appears (when alliance is expiring), and its behavior (hidden after agreement).
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.

@deshack deshack marked this pull request as draft February 2, 2026 17:40
@deshack
Copy link
Contributor Author

deshack commented Feb 2, 2026

Suggestion by tryout33:

Maybe two handshake icons? Also keep it green.

Both represent one of the players.

If one has accepted renewal, one of the handshake icons has solid white color. The other icon showing the player who hasn't decided yet, is shown pulsing from white to transparent. If both are undecided, both icons are pulsing. So you're immediately visually updated on if the other player has accepted yet.

The green behind the two handshake icons could also show as a timer just like the icon in the name layer does. Like an emptying hourglass

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.

1 participant