Skip to content

Defense Post Radius Overlay - #423

Closed
kanekane0448 wants to merge 20 commits into
openfrontio:v24from
kanekane0448:defense-post-radius-overlay
Closed

kanekane0448 wants to merge 20 commits into
openfrontio:v24from
kanekane0448:defense-post-radius-overlay

Conversation

@kanekane0448

@kanekane0448 kanekane0448 commented Apr 4, 2025 •

Copy link
Copy Markdown
Contributor

Description:

This adds an overlay that shows the Defense Post range not only on the border tiles but also on the inner territory tiles, in order to allow the player to spread out their Defense Posts or assess their opponent's Defense Post coverage more effectively. The overlay can be toggled on or off through the settings panel. It's off by default.

2025-04-04_18-36

Fixes #479

Please complete the following:

  • [ X ] I have added screenshots for all UI updates
  • [ X ] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced
  • [ X ] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors

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

kanekane0448

Comment thread README.md

Translators are welcome! Please feel free to help translate into your language.
How to help?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to add this or it wouldn't pass the prettier check

kanekane0448 added 2 commits April 16, 2025 21:29
# Conflicts:
#	src/core/configuration/PastelTheme.ts
#	src/core/configuration/PastelThemeDark.ts
@scottanderson scottanderson moved this from Triage to Pre-Development in OpenFront Release Management May 20, 2025
@scottanderson scottanderson moved this from Pre-Development to Peer Review in OpenFront Release Management May 20, 2025
@its-sii its-sii mentioned this pull request Jun 15, 2025
@scottanderson
scottanderson requested a review from a team as a code owner July 6, 2025 18:27
@scottanderson
scottanderson requested a review from evanpelle July 6, 2025 18:27
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


kanekane0448 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jul 31, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

A toggleable overlay for defense post range was introduced. New user settings, theme methods, and color constants support the feature. The options menu now includes a toggle button, and the territory rendering logic conditionally displays the defense post range on both border and inner tiles, using a darkened color. The overlay is off by default.

Changes

Cohort / File(s) Change Summary
Input Event Addition
src/client/InputHandler.ts
Added ToggleShowDefensePostRangeEvent class as a marker event for toggling defense post range display.
Options Menu Toggle
src/client/graphics/layers/OptionsMenu.ts
Added a toggle button and handler for showing/hiding defense post range in the options menu UI.
Territory Rendering Logic
src/client/graphics/layers/TerritoryLayer.ts
Updated rendering logic to conditionally show defense post range overlay and listen for toggle events.
Color Configuration
src/core/configuration/Colors.ts
Added defendedTerritoryDarkenPercent constant for darkening defended territory color.
Theme Interface Update
src/core/configuration/Config.ts
Extended Theme interface with defendedTerritoryColor(playerInfo) method.
Pastel Theme Implementation
src/core/configuration/PastelTheme.ts
Implemented defendedTerritoryColor method using the new darken percent.
Pastel Theme Dark Implementation
src/core/configuration/PastelThemeDark.ts
Implemented defendedTerritoryColor method using the new darken percent.
User Settings
src/core/game/UserSettings.ts
Added getter and toggle methods for the showDefensePostRange user setting, stored in localStorage.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant OptionsMenu
    participant UserSettings
    participant EventBus
    participant TerritoryLayer

    User->>OptionsMenu: Clicks "Show Defense Post Range" toggle
    OptionsMenu->>UserSettings: toggleShowDefensePostRange()
    OptionsMenu->>EventBus: emit(ToggleShowDefensePostRangeEvent)
    EventBus-->>TerritoryLayer: ToggleShowDefensePostRangeEvent
    TerritoryLayer->>TerritoryLayer: Update rendering logic
    TerritoryLayer->>UserSettings: showDefensePostRange()
    TerritoryLayer->>Theme: defendedTerritoryColor(player)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Assessment against linked issues

Objective Addressed Explanation
Add overlay showing Defense Post range on both border and inner territory tiles (#479) ✅
Overlay can be toggled on/off via settings panel, off by default (#479) ✅

Suggested reviewers

  • scottanderson

Poem

In the land of tiles and posts,
A toggle now appears—let’s boast!
Defense range shines, both near and far,
With colors darkened, like a star.
Settings hold the secret key,
Click to show, or let it be.
Overlay on, strategy anew—hooray for this review!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@drillskibo drillskibo added this to the v26 milestone Jul 31, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/core/configuration/PastelTheme.ts (1)

79-81: Fix parameter name inconsistency.

The implementation logic is correct, but the parameter name should match the interface definition for consistency.

-  defendedTerritoryColor(player: PlayerView): Colord {
-    return this.territoryColor(player).darken(defendedTerritoryDarkenPercent);
+  defendedTerritoryColor(playerInfo: PlayerView): Colord {
+    return this.territoryColor(playerInfo).darken(defendedTerritoryDarkenPercent);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3108921 and 7a49d6a.

📒 Files selected for processing (8)
  • src/client/InputHandler.ts (1 hunks)
  • src/client/graphics/layers/OptionsMenu.ts (3 hunks)
  • src/client/graphics/layers/TerritoryLayer.ts (5 hunks)
  • src/core/configuration/Colors.ts (1 hunks)
  • src/core/configuration/Config.ts (1 hunks)
  • src/core/configuration/PastelTheme.ts (2 hunks)
  • src/core/configuration/PastelThemeDark.ts (2 hunks)
  • src/core/game/UserSettings.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (8)
src/core/game/UserSettings.ts (1)

Learnt from: VariableVince
PR: #1110
File: src/client/Main.ts:293-295
Timestamp: 2025-06-09T02:20:43.637Z
Learning: In src/client/Main.ts, during game start in the handleJoinLobby callback, UI elements are hidden using direct DOM manipulation with classList.add("hidden") for consistency. This includes modals, buttons, and error divs. The codebase follows this pattern rather than using component APIs for hiding elements during game transitions.

src/core/configuration/Config.ts (4)

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/PastelThemeDark.ts:53-53
Timestamp: 2025-06-10T09:56:44.473Z
Learning: In ColorAllocator class in src/core/configuration/Colors.ts, the correct method names are assignColor(id: string): Colord for general color assignment and assignTeamColor(team: Team): Colord for team-specific colors. There are no assignPlayerColor() or assignBotColor() methods.

Learnt from: devalnor
PR: #1248
File: src/client/graphics/layers/TerritoryInfoLayer.ts:20-20
Timestamp: 2025-06-22T21:51:14.990Z
Learning: In TerritoryInfoLayer.ts, the highlightedTerritory field uses both null and undefined intentionally: undefined represents initial state or inactive layer (Ctrl released), while null represents active layer with no territory being highlighted at cursor position. This distinction is important for proper state change detection.

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/Colors.ts:114-330
Timestamp: 2025-06-06T15:36:31.739Z
Learning: In the OpenFrontIO project, color improvements are implemented incrementally. The current focus for player colors is ensuring sufficient unique color availability rather than optimizing for visual distinction or accessibility features.

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/PastelThemeDark.ts:20-21
Timestamp: 2025-06-06T15:42:21.903Z
Learning: In ColorAllocator class, all methods (assignBotColor, assignPlayerColor, assignTeamColor) use the constructor colors from this.availableColors. Only the predefined team cases in assignTeamColor use hardcoded global colors, while the default case uses constructor colors.

src/core/configuration/Colors.ts (5)

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/PastelThemeDark.ts:53-53
Timestamp: 2025-06-10T09:56:44.473Z
Learning: In ColorAllocator class in src/core/configuration/Colors.ts, the correct method names are assignColor(id: string): Colord for general color assignment and assignTeamColor(team: Team): Colord for team-specific colors. There are no assignPlayerColor() or assignBotColor() methods.

Learnt from: scottanderson
PR: #786
File: src/client/TerritoryPatternsModal.ts:337-338
Timestamp: 2025-06-22T05:48:19.241Z
Learning: In src/client/TerritoryPatternsModal.ts, the bit shifting operators (<<) used in coordinate calculations with decoder.getScale() are intentional and should not be changed to multiplication. The user scottanderson confirmed this is functioning as intended.

Learnt from: devalnor
PR: #1248
File: src/client/graphics/layers/TerritoryInfoLayer.ts:20-20
Timestamp: 2025-06-22T21:51:14.990Z
Learning: In TerritoryInfoLayer.ts, the highlightedTerritory field uses both null and undefined intentionally: undefined represents initial state or inactive layer (Ctrl released), while null represents active layer with no territory being highlighted at cursor position. This distinction is important for proper state change detection.

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/PastelThemeDark.ts:20-21
Timestamp: 2025-06-06T15:42:21.903Z
Learning: In ColorAllocator class, all methods (assignBotColor, assignPlayerColor, assignTeamColor) use the constructor colors from this.availableColors. Only the predefined team cases in assignTeamColor use hardcoded global colors, while the default case uses constructor colors.

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/Colors.ts:114-330
Timestamp: 2025-06-06T15:36:31.739Z
Learning: In the OpenFrontIO project, color improvements are implemented incrementally. The current focus for player colors is ensuring sufficient unique color availability rather than optimizing for visual distinction or accessibility features.

src/core/configuration/PastelThemeDark.ts (7)

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/PastelThemeDark.ts:53-53
Timestamp: 2025-06-10T09:56:44.473Z
Learning: In ColorAllocator class in src/core/configuration/Colors.ts, the correct method names are assignColor(id: string): Colord for general color assignment and assignTeamColor(team: Team): Colord for team-specific colors. There are no assignPlayerColor() or assignBotColor() methods.

Learnt from: devalnor
PR: #1248
File: src/client/graphics/layers/TerritoryInfoLayer.ts:20-20
Timestamp: 2025-06-22T21:51:14.990Z
Learning: In TerritoryInfoLayer.ts, the highlightedTerritory field uses both null and undefined intentionally: undefined represents initial state or inactive layer (Ctrl released), while null represents active layer with no territory being highlighted at cursor position. This distinction is important for proper state change detection.

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/Colors.ts:114-330
Timestamp: 2025-06-06T15:36:31.739Z
Learning: In the OpenFrontIO project, color improvements are implemented incrementally. The current focus for player colors is ensuring sufficient unique color availability rather than optimizing for visual distinction or accessibility features.

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/Colors.ts:398-411
Timestamp: 2025-06-06T21:43:15.706Z
Learning: In ColorAllocator class, the assignPlayerColor method intentionally allows color duplicates when the humanColors palette is exhausted by resetting availableColors to the full humanColors array. This is done on purpose as an acceptable temporary limitation, with potential palette improvements planned for later.

Learnt from: 1brucben
PR: #977
File: src/core/execution/AttackExecution.ts:123-125
Timestamp: 2025-05-31T18:15:03.445Z
Learning: The removeTroops function in PlayerImpl.ts already prevents negative troop counts by using minInt(this._troops, toInt(troops)) to ensure it never removes more troops than available.

Learnt from: scottanderson
PR: #786
File: src/client/TerritoryPatternsModal.ts:337-338
Timestamp: 2025-06-22T05:48:19.241Z
Learning: In src/client/TerritoryPatternsModal.ts, the bit shifting operators (<<) used in coordinate calculations with decoder.getScale() are intentional and should not be changed to multiplication. The user scottanderson confirmed this is functioning as intended.

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/PastelThemeDark.ts:20-21
Timestamp: 2025-06-06T15:42:21.903Z
Learning: In ColorAllocator class, all methods (assignBotColor, assignPlayerColor, assignTeamColor) use the constructor colors from this.availableColors. Only the predefined team cases in assignTeamColor use hardcoded global colors, while the default case uses constructor colors.

src/client/graphics/layers/OptionsMenu.ts (1)

Learnt from: VariableVince
PR: #1110
File: src/client/Main.ts:293-295
Timestamp: 2025-06-09T02:20:43.637Z
Learning: In src/client/Main.ts, during game start in the handleJoinLobby callback, UI elements are hidden using direct DOM manipulation with classList.add("hidden") for consistency. This includes modals, buttons, and error divs. The codebase follows this pattern rather than using component APIs for hiding elements during game transitions.

src/client/InputHandler.ts (1)

Learnt from: VariableVince
PR: #1110
File: src/client/Main.ts:293-295
Timestamp: 2025-06-09T02:20:43.637Z
Learning: In src/client/Main.ts, during game start in the handleJoinLobby callback, UI elements are hidden using direct DOM manipulation with classList.add("hidden") for consistency. This includes modals, buttons, and error divs. The codebase follows this pattern rather than using component APIs for hiding elements during game transitions.

src/core/configuration/PastelTheme.ts (7)

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/PastelThemeDark.ts:53-53
Timestamp: 2025-06-10T09:56:44.473Z
Learning: In ColorAllocator class in src/core/configuration/Colors.ts, the correct method names are assignColor(id: string): Colord for general color assignment and assignTeamColor(team: Team): Colord for team-specific colors. There are no assignPlayerColor() or assignBotColor() methods.

Learnt from: devalnor
PR: #1248
File: src/client/graphics/layers/TerritoryInfoLayer.ts:20-20
Timestamp: 2025-06-22T21:51:14.990Z
Learning: In TerritoryInfoLayer.ts, the highlightedTerritory field uses both null and undefined intentionally: undefined represents initial state or inactive layer (Ctrl released), while null represents active layer with no territory being highlighted at cursor position. This distinction is important for proper state change detection.

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/Colors.ts:114-330
Timestamp: 2025-06-06T15:36:31.739Z
Learning: In the OpenFrontIO project, color improvements are implemented incrementally. The current focus for player colors is ensuring sufficient unique color availability rather than optimizing for visual distinction or accessibility features.

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/Colors.ts:398-411
Timestamp: 2025-06-06T21:43:15.706Z
Learning: In ColorAllocator class, the assignPlayerColor method intentionally allows color duplicates when the humanColors palette is exhausted by resetting availableColors to the full humanColors array. This is done on purpose as an acceptable temporary limitation, with potential palette improvements planned for later.

Learnt from: scottanderson
PR: #786
File: src/client/TerritoryPatternsModal.ts:337-338
Timestamp: 2025-06-22T05:48:19.241Z
Learning: In src/client/TerritoryPatternsModal.ts, the bit shifting operators (<<) used in coordinate calculations with decoder.getScale() are intentional and should not be changed to multiplication. The user scottanderson confirmed this is functioning as intended.

Learnt from: 1brucben
PR: #977
File: src/core/execution/AttackExecution.ts:123-125
Timestamp: 2025-05-31T18:15:03.445Z
Learning: The removeTroops function in PlayerImpl.ts already prevents negative troop counts by using minInt(this._troops, toInt(troops)) to ensure it never removes more troops than available.

Learnt from: Ble4Ch
PR: #1063
File: src/core/configuration/PastelThemeDark.ts:20-21
Timestamp: 2025-06-06T15:42:21.903Z
Learning: In ColorAllocator class, all methods (assignBotColor, assignPlayerColor, assignTeamColor) use the constructor colors from this.availableColors. Only the predefined team cases in assignTeamColor use hardcoded global colors, while the default case uses constructor colors.

src/client/graphics/layers/TerritoryLayer.ts (3)

Learnt from: devalnor
PR: #1248
File: src/client/graphics/layers/TerritoryInfoLayer.ts:20-20
Timestamp: 2025-06-22T21:51:14.990Z
Learning: In TerritoryInfoLayer.ts, the highlightedTerritory field uses both null and undefined intentionally: undefined represents initial state or inactive layer (Ctrl released), while null represents active layer with no territory being highlighted at cursor position. This distinction is important for proper state change detection.

Learnt from: scottanderson
PR: #786
File: src/client/TerritoryPatternsModal.ts:337-338
Timestamp: 2025-06-22T05:48:19.241Z
Learning: In src/client/TerritoryPatternsModal.ts, the bit shifting operators (<<) used in coordinate calculations with decoder.getScale() are intentional and should not be changed to multiplication. The user scottanderson confirmed this is functioning as intended.

Learnt from: VariableVince
PR: #1110
File: src/client/Main.ts:293-295
Timestamp: 2025-06-09T02:20:43.637Z
Learning: In src/client/Main.ts, during game start in the handleJoinLobby callback, UI elements are hidden using direct DOM manipulation with classList.add("hidden") for consistency. This includes modals, buttons, and error divs. The codebase follows this pattern rather than using component APIs for hiding elements during game transitions.

🧬 Code Graph Analysis (5)
src/core/configuration/Config.ts (1)
src/core/game/GameView.ts (1)
  • PlayerView (125-270)
src/core/configuration/PastelThemeDark.ts (2)
src/core/game/GameView.ts (1)
  • PlayerView (125-270)
src/core/configuration/Colors.ts (1)
  • defendedTerritoryDarkenPercent (12-12)
src/client/graphics/layers/OptionsMenu.ts (1)
src/client/InputHandler.ts (1)
  • ToggleShowDefensePostRangeEvent (62-62)
src/client/InputHandler.ts (1)
src/core/EventBus.ts (1)
  • GameEvent (1-1)
src/core/configuration/PastelTheme.ts (2)
src/core/game/GameView.ts (1)
  • PlayerView (125-270)
src/core/configuration/Colors.ts (1)
  • defendedTerritoryDarkenPercent (12-12)
🔇 Additional comments (16)
src/client/InputHandler.ts (1)

62-63: LGTM! Clean marker event implementation.

The new event follows the established pattern for marker events in this file. The naming is clear and consistent with other toggle events.

src/core/game/UserSettings.ts (2)

33-35: LGTM! Consistent with existing settings pattern.

The getter method follows the established pattern and correctly defaults to false as specified in the PR objectives.


58-60: LGTM! Standard toggle implementation.

The toggle method correctly follows the existing pattern used by other settings in this class.

src/core/configuration/Colors.ts (1)

12-12: LGTM! Well-named constant for consistent theming.

The 7.5% darkening factor provides a good balance for visual distinction without being too strong. Having this as a shared constant ensures consistency across different theme implementations.

src/core/configuration/Config.ts (1)

129-129: LGTM! Clean interface extension.

The new method signature follows the established pattern for theme color methods. The parameter and return types are appropriate for the defended territory color feature.

src/core/configuration/PastelTheme.ts (1)

11-11: LGTM! Proper import for consistent theming.

Good use of the shared constant to ensure consistent darkening across all theme implementations.

src/core/configuration/PastelThemeDark.ts (2)

11-11: LGTM: Clean import of configuration constant.

The defendedTerritoryDarkenPercent constant is properly imported from the Colors configuration file, maintaining separation of concerns.


79-81: LGTM: Simple and consistent implementation.

The defendedTerritoryColor method follows the established pattern of other color methods in this theme class. The implementation is clean - it reuses the existing territoryColor method and applies a consistent darkening effect using the imported configuration constant.

src/client/graphics/layers/OptionsMenu.ts (3)

8-12: LGTM: Clean import structure.

The import statement properly includes the new ToggleShowDefensePostRangeEvent while maintaining the existing structure and formatting.


122-125: LGTM: Consistent toggle method implementation.

The onToggleShowDefensePostRange method follows the established pattern of other toggle methods in this class - it toggles the user setting and emits the corresponding event. The implementation is clean and consistent.


226-232: LGTM: Well-integrated settings button.

The new defense post range button follows the established pattern of other settings buttons. The shield emoji (🛡️) is appropriate for the defense post feature, and the "Show"/"Hide" text clearly indicates the current state.

src/client/graphics/layers/TerritoryLayer.ts (5)

14-18: LGTM: Clean import structure.

The import statement properly includes the new ToggleShowDefensePostRangeEvent while maintaining the existing structure and formatting.


73-88: LGTM: Well-structured conditional logic.

The defense post handling logic is clean and readable. The distance function selection using a conditional assignment is clear, and the BFS logic properly handles both border tiles (always) and all tiles (when setting is enabled). The owner ID check for border tiles ensures correct behavior.


152-159: LGTM: Efficient event handling.

The event listener properly handles the toggle by re-enqueueing all affected tiles using Euclidean distance for the full range display. This ensures the UI updates correctly when the setting is toggled.


267-271: LGTM: Clean boolean extraction improves readability.

Extracting tileIsInDefensePostRange as a boolean variable makes the subsequent conditional logic much more readable and follows the principle of single responsibility.


296-302: LGTM: Clear conditional color selection.

The color selection logic is well-structured with clear conditions. The implementation properly checks both the defense post range status and the user setting before applying the defended territory color, maintaining good separation between border and non-border tile handling.

@drillskibo drillskibo linked an issue Aug 7, 2025 that may be closed by this pull request
@drillskibo drillskibo removed a link to an issue Aug 7, 2025
@drillskibo drillskibo linked an issue Aug 7, 2025 that may be closed by this pull request
@TheGiraffe3

Copy link
Copy Markdown
Member

@kanekane0448 could you resolve conflicts?

@DanyPops

Copy link
Copy Markdown
Contributor

@TheGiraffe3 This is beneficial, I'm willing to pick this up, this should be extended to all types of buildings.
@kanekane0448 Are you still interested in implementing this feature?

@TheGiraffe3

Copy link
Copy Markdown
Member

@DanyPops I'd say go for it, since the original author hasn't responded.

@github-project-automation github-project-automation Bot moved this from Peer Review to Complete in OpenFront Release Management Sep 29, 2025
@TheGiraffe3 TheGiraffe3 removed this from the v26 milestone Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Defense Post Radius Overlay

5 participants