Repository navigation
Nuke preview - #1814
Nuke preview#1814Dimitrije-V wants to merge 49 commits into
Conversation
…io#1597) ## Description: This PR implements a new feature allowing automatic upgrade of the nearest building using the middle mouse button. This feature greatly simplifies the upgrade process that previously required a right-click + building recreation. ## 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 - [x] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: Kipstzz --------- Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
…tio#1643) ## Description: Checks that each lang file’s lang_code matches its filename and that the flag SVG exists. Reports all errors in a single test run for easier debugging. ## 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 - [x] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: aotumuri Co-authored-by: Drills Kibo <59177241+drillskibo@users.noreply.github.com>
## Description: Added a red delete button with trash can icon to the right-click radial menu that allows players to voluntarily delete their own units. ## 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 - [x] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: Kipstz <img width="286" height="209" alt="image" src="https://github.com/user-attachments/assets/85142be3-2aa5-4c84-ab30-0c68289c8f85" /> --------- Co-authored-by: Drills Kibo <59177241+drillskibo@users.noreply.github.com>
## Description: Strict mode is causing docker deployments to fail. This commit reverts only the strict mode setting itself, while keeping the code changes, so that we can re-enable it more easily in the future. ## 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 - [ ] I have read and accepted the CLA agreement (only required once).
Fixes openfrontio#1559 ## Description: The current Mars map has several issues: - The map is very underdetailed - The coastlines are very smooth and visually unappealing - The map was created from an incompatible source image, which results in the height data being very wrong - As a result the map hardly resembles Mars at all. - There is too much land - The major landmass is almost entirely covered in plains - The ocean doesn't match the heightmap - The gameplay is boring - The map is very succeptable to snowballing issues - The map seems commonly disliked in the community I attempted to remedy this. - The water level and elevation are calculated from accurate height data - Water level is much higher making the map much more interesting, both in the gameplay and visual aspect. - The map has several contitents which should slow down snowballing - The map is much more detailed overall - I added a lot more NPC's. 8 for such a big map just wasn't enough. <img width="2500" height="1150" alt="Mars_Out2" src="https://github.com/user-attachments/assets/7b7009f7-6376-4059-b731-86931df8f926" /> - [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 - [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: aceralex --------- Co-authored-by: Drills Kibo <59177241+drillskibo@users.noreply.github.com>
…ntio#1680) ## Description: Switches away from ts-jest in favor of @swc/jest. On my local I observe a ten-fold decrease in how long it takes the test suite to run. No changes are required to how our existing tests are written. Benchmarking old: 24.658s new: 2.268s ts-jest (old) ``` Test Suites: 29 passed, 29 total Tests: 215 passed, 215 total Snapshots: 0 total Time: 24.658 s Ran all test suites. ``` swc-jest (new) ``` Test Suites: 29 passed, 29 total Tests: 215 passed, 215 total Snapshots: 0 total Time: 2.268 s Ran all test suites. ``` Fixes openfrontio#1679 ## 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 - [x] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: slyty
## Description: This pull request adds support for ICU (Intl MessageFormat) syntax in the translation system. Existing translation files may need to be updated to fully leverage ICU features. ## 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 - [x] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: DISCORD_USERNAME
…ontio#1723) ## Description: Add frontend-approver and backend-approver to CODEOWNERS file ## 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 - [ ] I have read and accepted the CLA agreement (only required once).
…ontio#1481) Bumps the npm_and_yarn group with 2 updates in the / directory: [on-headers](https://github.com/jshttp/on-headers) and [compression](https://github.com/expressjs/compression). Updates `on-headers` from 1.0.2 to 1.1.0 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/jshttp/on-headers/releases">on-headers's releases</a>.</em></p> <blockquote> <h2>1.1.0</h2> <h2>Important</h2> <ul> <li>Fix <a href="https://www.cve.org/CVERecord?id=CVE-2025-7339">CVE-2025-7339</a> (<a href="https://github.com/jshttp/on-headers/security/advisories/GHSA-76c9-3jph-rj3q">GHSA-76c9-3jph-rj3q</a>)</li> </ul> <h2>What's Changed</h2> <ul> <li>Migrate CI pipeline to GitHub actions by <a href="https://github.com/carpasse"><code>@carpasse</code></a> in <a href="https://redirect.github.com/jshttp/on-headers/pull/12">jshttp/on-headers#12</a></li> <li>fix README.md badges by <a href="https://github.com/carpasse"><code>@carpasse</code></a> in <a href="https://redirect.github.com/jshttp/on-headers/pull/13">jshttp/on-headers#13</a></li> <li>add OSSF scorecard action by <a href="https://github.com/carpasse"><code>@carpasse</code></a> in <a href="https://redirect.github.com/jshttp/on-headers/pull/14">jshttp/on-headers#14</a></li> <li>fix: use <code>ubuntu-latest</code> as ci runner by <a href="https://github.com/UlisesGascon"><code>@UlisesGascon</code></a> in <a href="https://redirect.github.com/jshttp/on-headers/pull/19">jshttp/on-headers#19</a></li> <li>ci: apply OSSF Scorecard security best practices by <a href="https://github.com/UlisesGascon"><code>@UlisesGascon</code></a> in <a href="https://redirect.github.com/jshttp/on-headers/pull/20">jshttp/on-headers#20</a></li> <li>👷 add upstream change detection by <a href="https://github.com/ctcpip"><code>@ctcpip</code></a> in <a href="https://redirect.github.com/jshttp/on-headers/pull/31">jshttp/on-headers#31</a></li> <li>✨ add script to update known hashes by <a href="https://github.com/ctcpip"><code>@ctcpip</code></a> in <a href="https://redirect.github.com/jshttp/on-headers/pull/32">jshttp/on-headers#32</a></li> <li>💚 update CI - add newer node versions by <a href="https://github.com/ctcpip"><code>@ctcpip</code></a> in <a href="https://redirect.github.com/jshttp/on-headers/pull/33">jshttp/on-headers#33</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/carpasse"><code>@carpasse</code></a> made their first contribution in <a href="https://redirect.github.com/jshttp/on-headers/pull/12">jshttp/on-headers#12</a></li> <li><a href="https://github.com/UlisesGascon"><code>@UlisesGascon</code></a> made their first contribution in <a href="https://redirect.github.com/jshttp/on-headers/pull/19">jshttp/on-headers#19</a></li> <li><a href="https://github.com/ctcpip"><code>@ctcpip</code></a> made their first contribution in <a href="https://redirect.github.com/jshttp/on-headers/pull/31">jshttp/on-headers#31</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/jshttp/on-headers/compare/v1.0.2...v1.1.0">https://github.com/jshttp/on-headers/compare/v1.0.2...v1.1.0</a></p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/jshttp/on-headers/blob/master/HISTORY.md">on-headers's changelog</a>.</em></p> <blockquote> <h1>1.1.0 / 2025-07-17</h1> <ul> <li>Fix <a href="https://www.cve.org/CVERecord?id=CVE-2025-7339">CVE-2025-7339</a> (<a href="https://github.com/jshttp/on-headers/security/advisories/GHSA-76c9-3jph-rj3q">GHSA-76c9-3jph-rj3q</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/jshttp/on-headers/commit/4b017af88f5375bbdf3ad2ee732d2c122e4f52b0"><code>4b017af</code></a> 1.1.0</li> <li><a href="https://github.com/jshttp/on-headers/commit/b636f2d08e6c1e0a784b53a13cd61e05c09bb118"><code>b636f2d</code></a> ♻️ refactor header array code</li> <li><a href="https://github.com/jshttp/on-headers/commit/3e2c2d46c3e9592f6a1c3a3a1dbe622401f95d39"><code>3e2c2d4</code></a> ✨ ignore falsy header keys, matching node behavior</li> <li><a href="https://github.com/jshttp/on-headers/commit/172eb41b99a5a290b27a2c43fe602ca33aa1c8ce"><code>172eb41</code></a> ✨ support duplicate headers</li> <li><a href="https://github.com/jshttp/on-headers/commit/c6e384908c9c6127d18831d16ab0bd96e1231867"><code>c6e3849</code></a> 🔒️ fix array handling</li> <li><a href="https://github.com/jshttp/on-headers/commit/6893518341bb4e5363285df086b3158302d3b216"><code>6893518</code></a> 💚 update CI - add newer node versions</li> <li><a href="https://github.com/jshttp/on-headers/commit/56a345d82b51a0dcb8d09f061f87b1fd1dc4c01e"><code>56a345d</code></a> ✨ add script to update known hashes</li> <li><a href="https://github.com/jshttp/on-headers/commit/175ab217155d525371a5416ff059f895a3a532a6"><code>175ab21</code></a> 👷 add upstream change detection (<a href="https://redirect.github.com/jshttp/on-headers/issues/31">#31</a>)</li> <li><a href="https://github.com/jshttp/on-headers/commit/ce0b2c8fcd313d38d3534fb731050dc16e105bf6"><code>ce0b2c8</code></a> ci: apply OSSF Scorecard security best practices (<a href="https://redirect.github.com/jshttp/on-headers/issues/20">#20</a>)</li> <li><a href="https://github.com/jshttp/on-headers/commit/1a38c543e75cd06217b449531de10b1758e35299"><code>1a38c54</code></a> fix: use <code>ubuntu-latest</code> as ci runner (<a href="https://redirect.github.com/jshttp/on-headers/issues/19">#19</a>)</li> <li>Additional commits viewable in <a href="https://github.com/jshttp/on-headers/compare/v1.0.2...v1.1.0">compare view</a></li> </ul> </details> <details> <summary>Maintainer changes</summary> <p>This version was pushed to npm by <a href="https://www.npmjs.com/~ulisesgascon">ulisesgascon</a>, a new releaser for on-headers since your current version.</p> </details> <br /> Updates `compression` from 1.8.0 to 1.8.1 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/expressjs/compression/releases">compression's releases</a>.</em></p> <blockquote> <h2>v1.8.1</h2> <h2>What's Changed</h2> <ul> <li>fix(docs): update multiple links from http to https by <a href="https://github.com/Phillip9587"><code>@Phillip9587</code></a> in <a href="https://redirect.github.com/expressjs/compression/pull/222">expressjs/compression#222</a></li> <li>ci: add dependabot for github actions by <a href="https://github.com/bjohansebas"><code>@bjohansebas</code></a> in <a href="https://redirect.github.com/expressjs/compression/pull/207">expressjs/compression#207</a></li> <li>build(deps): bump github/codeql-action from 2.23.2 to 3.28.15 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/expressjs/compression/pull/228">expressjs/compression#228</a></li> <li>build(deps): bump ossf/scorecard-action from 2.3.1 to 2.4.1 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/expressjs/compression/pull/229">expressjs/compression#229</a></li> <li>build(deps-dev): bump eslint-plugin-import from 2.26.0 to 2.31.0 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/expressjs/compression/pull/230">expressjs/compression#230</a></li> <li>build(deps-dev): bump supertest from 6.2.3 to 6.3.4 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/expressjs/compression/pull/231">expressjs/compression#231</a></li> <li>[StepSecurity] ci: Harden GitHub Actions by <a href="https://github.com/step-security-bot"><code>@step-security-bot</code></a> in <a href="https://redirect.github.com/expressjs/compression/pull/235">expressjs/compression#235</a></li> <li>build(deps): bump github/codeql-action from 3.28.15 to 3.29.2 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/expressjs/compression/pull/243">expressjs/compression#243</a></li> <li>build(deps): bump actions/upload-artifact from 4.3.1 to 4.6.2 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/expressjs/compression/pull/239">expressjs/compression#239</a></li> <li>build(deps): bump ossf/scorecard-action from 2.4.1 to 2.4.2 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/expressjs/compression/pull/240">expressjs/compression#240</a></li> <li>build(deps): bump actions/checkout from 4.1.1 to 4.2.2 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/expressjs/compression/pull/241">expressjs/compression#241</a></li> <li>build(deps-dev): bump eslint-plugin-import from 2.31.0 to 2.32.0 by <a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] in <a href="https://redirect.github.com/expressjs/compression/pull/244">expressjs/compression#244</a></li> <li>deps: on-headers@1.1.0 by <a href="https://github.com/UlisesGascon"><code>@UlisesGascon</code></a> in <a href="https://redirect.github.com/expressjs/compression/pull/246">expressjs/compression#246</a></li> <li>Release: 1.8.1 by <a href="https://github.com/UlisesGascon"><code>@UlisesGascon</code></a> in <a href="https://redirect.github.com/expressjs/compression/pull/247">expressjs/compression#247</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/dependabot"><code>@dependabot</code></a>[bot] made their first contribution in <a href="https://redirect.github.com/expressjs/compression/pull/228">expressjs/compression#228</a></li> <li><a href="https://github.com/step-security-bot"><code>@step-security-bot</code></a> made their first contribution in <a href="https://redirect.github.com/expressjs/compression/pull/235">expressjs/compression#235</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/expressjs/compression/compare/1.8.0...v1.8.1">https://github.com/expressjs/compression/compare/1.8.0...v1.8.1</a></p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/expressjs/compression/blob/master/HISTORY.md">compression's changelog</a>.</em></p> <blockquote> <h1>1.8.1 / 2025-07-17</h1> <ul> <li>deps: on-headers@~1.1.0 <ul> <li>Fix <a href="https://www.cve.org/CVERecord?id=CVE-2025-7339">CVE-2025-7339</a> (<a href="https://github.com/expressjs/on-headers/security/advisories/GHSA-76c9-3jph-rj3q">GHSA-76c9-3jph-rj3q</a>)</li> </ul> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/expressjs/compression/commit/83a0c45fe190f4fcb8b515c18065db9cb9029dd1"><code>83a0c45</code></a> 1.8.1</li> <li><a href="https://github.com/expressjs/compression/commit/ce62713129f4b33eac4b833e1722410091646395"><code>ce62713</code></a> deps: on-headers@1.1.0 (<a href="https://redirect.github.com/expressjs/compression/issues/246">#246</a>)</li> <li><a href="https://github.com/expressjs/compression/commit/f4acb23985fa345318d34d4a96acf555a883efeb"><code>f4acb23</code></a> build(deps-dev): bump eslint-plugin-import from 2.31.0 to 2.32.0 (<a href="https://redirect.github.com/expressjs/compression/issues/244">#244</a>)</li> <li><a href="https://github.com/expressjs/compression/commit/6eaebe63f2ecac191d402c570bde140488435c4c"><code>6eaebe6</code></a> build(deps): bump actions/checkout from 4.1.1 to 4.2.2 (<a href="https://redirect.github.com/expressjs/compression/issues/241">#241</a>)</li> <li><a href="https://github.com/expressjs/compression/commit/37e062312fd270f84b5f50f7c6f88312609633f5"><code>37e0623</code></a> build(deps): bump ossf/scorecard-action from 2.4.1 to 2.4.2 (<a href="https://redirect.github.com/expressjs/compression/issues/240">#240</a>)</li> <li><a href="https://github.com/expressjs/compression/commit/bc436b26283c2f85a9711085dd0e4a580de50ba7"><code>bc436b2</code></a> build(deps): bump actions/upload-artifact from 4.3.1 to 4.6.2 (<a href="https://redirect.github.com/expressjs/compression/issues/239">#239</a>)</li> <li><a href="https://github.com/expressjs/compression/commit/2f9f5726751ecf12f7c46a9d1493bcd1966e09a7"><code>2f9f572</code></a> build(deps): bump github/codeql-action from 3.28.15 to 3.29.2 (<a href="https://redirect.github.com/expressjs/compression/issues/243">#243</a>)</li> <li><a href="https://github.com/expressjs/compression/commit/5f13b148d2a1a2daaa8647e03592214bb240bf18"><code>5f13b14</code></a> [StepSecurity] ci: Harden GitHub Actions (<a href="https://redirect.github.com/expressjs/compression/issues/235">#235</a>)</li> <li><a href="https://github.com/expressjs/compression/commit/76e094548125afbf8089a482d5982dc96c7ce398"><code>76e0945</code></a> build(deps-dev): bump supertest from 6.2.3 to 6.3.4 (<a href="https://redirect.github.com/expressjs/compression/issues/231">#231</a>)</li> <li><a href="https://github.com/expressjs/compression/commit/ae6ee809dc0cb40febaf2a5bff298465bd5a207f"><code>ae6ee80</code></a> build(deps-dev): bump eslint-plugin-import from 2.26.0 to 2.31.0 (<a href="https://redirect.github.com/expressjs/compression/issues/230">#230</a>)</li> <li>Additional commits viewable in <a href="https://github.com/expressjs/compression/compare/1.8.0...v1.8.1">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/openfrontio/OpenFrontIO/network/alerts). </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
## Description: Added 2-fingers control for map with trackpad ## 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 - [x] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: pierre_brtr
## Description: Enable the `sort-keys` eslint rule. Fixes openfrontio#1629 ## 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 - [ ] I have read and accepted the CLA agreement (only required once).
## Description: Problem: attacking a player right before accepting an alliance request is very effective since the requester can't fight back or reclaim his territory without canceling the alliance and being penalized with the traitor debuff. Change: - Attacking a player after he requested an alliance automatically rejects the request - No changes to existing attacks in both directions, only new attacks affect the request ## 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 - [x] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: IngloriousTom
## Description: The websocket message handler functions have gotten quite large. This change extracts them to functions in their own file, and extracts the `"join"` message acceptance logic into its own function allowing for all cases to be accounted for when we add error messages in openfrontio#1447. ## 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 - [ ] I have read and accepted the CLA agreement (only required once).
## Description: Enable `@total-typescript/ts-reset` Fixes openfrontio#1760 ## 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 - [ ] I have read and accepted the CLA agreement (only required once).
## Description: Update the code for strict mode. ## 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 - [ ] I have read and accepted the CLA agreement (only required once).
## Description: Enable eslint warning for `@typescript-eslint/consistent-type-assertions`. While build warnings are generally a discouraged pattern, we are actively working to drive the number of warnings down to zero, at which point we will convert the warnings to errors. ## 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 - [ ] I have read and accepted the CLA agreement (only required once).
## Description: Since the in-game Settings became their own modal in v24, it blocks game control but the game goes on in the background. On mobile it is full screen so you don't even notice the game still playing in the background. Of course players understand that a Multiplayer game will move on. But for Single Player, the game mode played by beginners too, you'd expect the game to be paused and are surprised when it isn't. Same goes for Replays. This PR fixes it: - Pause when opening the in-game Settings modal during replay or single player game. - Unpause again when closing the Settings modal (if not already paused before opening the Settings). - The icon for pause/unpause isn't switched in GameRightSideBar during this, as the sidebar is blurred in the background anyway. ## 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 - [ ] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: tryout33 --------- Co-authored-by: Drills Kibo <59177241+drillskibo@users.noreply.github.com>
## Description: Re-enable strict mode ## 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
## Description: Remove CLA from the PR description template and PR check. This is handled through a dedicated status check, so the description is not needed. ## 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
## Description: Describe the PR. This PR makes the playerInfoOverlay collapsible by clicking on the player name. This overlay was covering a decent chunk of the mobile screen.  Now the details can be toggled by just clicking on the name freeing a lot of the screen on mobile.  ## 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 - [x] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: DISCORD_USERNAME tls_15 Co-authored-by: Drills Kibo <59177241+drillskibo@users.noreply.github.com>
## Description: Resolve openfrontio#1652 1. Add the ability to toggle **gold donations** and **troop donations** for private lobbies ~2. Add relevant translations.~ 3. Refactor `canDonate` to be specific to gold and troop donations 4. Add placeholders for singleplayer mode if this is to be extended to support that too. 5. Add Tests for Donate logic ### Screenshots: <img width="1643" height="1788" alt="image" src="https://github.com/user-attachments/assets/82b93400-a1f0-45f0-8b2b-a7f78dc0c3e9" /> _Private Lobby_ ### Smoke Tests  _Testing Troop Send In Private Lobby_  _Troop Send Complete In Private Lobby_  Confirming that public teams still works ## 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 - [X] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: DISCORD_USERNAME: cool_clarky --------- Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com> Co-authored-by: Drills Kibo <59177241+drillskibo@users.noreply.github.com>
## Description: Enable various eslint rules. ## 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
## Description: Enable eslint rule `@stylistic/ts/indent`. Fixes openfrontio#1778 ## 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
## Description: Enable more stylistic rules. ## 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
## Description: Enable eslint rule `quote-props` ## 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
## Description: Enable enforcement of various eslint style rules. ## 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
## Description: Have at least 2 clients and majority vote to decide a winner ## 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 --------- Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
## Description: Restore code that was accidentally deleted in the previous PR. ## 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
merge conflicts
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (5)
src/client/graphics/layers/PlayerActionHandler.ts (1)
38-40: Optional: Clear nukeAnchor on stop to avoid stale anchorsIf the menu closes while previewing, you can end up with a leftover anchor. Consider also clearing
nukeAnchorwhen stopping the preview. If other flows rely on keeping the last anchor, ignore this.For clarity, update as follows (outside the shown segment):
stopNukePreview() { this.uiState.nukePreview = undefined; + this.uiState.nukeAnchor = undefined; }src/client/graphics/GameRenderer.ts (1)
52-52: Annotate uiState and drop redundant undefinedPrefer an explicit type and omit optional fields when not set. This makes the intent clearer and avoids accidental shape drift.
Apply this diff:
- const uiState = { attackRatio: 20, nukePreview: undefined }; + const uiState: UIState = { attackRatio: 20 };tests/client/graphics/RadialMenuElements.test.ts (1)
515-579: Great coverage for hover-driven nuke previewsThe tests assert isNuke, set/clear on hover, and exclude non-nukes. Consider adding a Hydrogen Bomb case to cover the full nuclear set.
src/client/graphics/layers/BuildMenu.ts (1)
372-378: Duplicate helper function across files.The
isNukeTypehelper is duplicated in both BuildMenu.ts and RadialMenuElements.ts. Consider extracting this to a shared utility.Would you like me to create a shared utility file for nuclear-related helpers to avoid duplication?
src/client/graphics/layers/NukePreview.ts (1)
189-189: Type assertion could be improved.The code uses
(anchorOwner as any).id()which bypasses TypeScript's type checking. Consider using a proper type guard.- const sig = `MIRV|${ax}|${ay}|${anchorOwner.isPlayer() ? (anchorOwner as any).id() : "TN"}`; + const sig = `MIRV|${ax}|${ay}|${anchorOwner.isPlayer() ? (anchorOwner as PlayerView).id() : "TN"}`;Note: You'll need to import
PlayerViewfrom the appropriate module.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
📒 Files selected for processing (10)
src/client/graphics/GameRenderer.ts(4 hunks)src/client/graphics/UIState.ts(1 hunks)src/client/graphics/layers/BuildMenu.ts(8 hunks)src/client/graphics/layers/MainRadialMenu.ts(2 hunks)src/client/graphics/layers/NukePreview.ts(1 hunks)src/client/graphics/layers/PlayerActionHandler.ts(2 hunks)src/client/graphics/layers/RadialMenu.ts(6 hunks)src/client/graphics/layers/RadialMenuElements.ts(6 hunks)tests/client/graphics/NukePreview.test.ts(1 hunks)tests/client/graphics/RadialMenuElements.test.ts(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-05-18T23:36:12.847Z
Learnt from: scottanderson
PR: openfrontio/OpenFrontIO#784
File: src/core/game/StatsImpl.ts:143-159
Timestamp: 2025-05-18T23:36:12.847Z
Learning: In this codebase, NukeType is a union type derived from UnitType values (specifically bomb-related values like AtomBomb, HydrogenBomb, MIRV, and MIRVWarhead) rather than a separate enum. This means comparing NukeType values against UnitType values in switch statements is valid and intentional.
Applied to files:
src/client/graphics/layers/PlayerActionHandler.tssrc/client/graphics/layers/BuildMenu.tssrc/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-06-16T03:03:59.778Z
Learnt from: VariableVince
PR: openfrontio/OpenFrontIO#1192
File: src/client/graphics/layers/RadialMenuElements.ts:312-314
Timestamp: 2025-06-16T03:03:59.778Z
Learning: In RadialMenuElements.ts, when fixing undefined params errors in subMenu functions, use explicit checks like `if (params === undefined || params.selected === null)` rather than optional chaining, as it makes the intent clearer and matches the specific error scenarios where params can be undefined during spawn phase operations.
Applied to files:
tests/client/graphics/RadialMenuElements.test.tssrc/client/graphics/layers/RadialMenu.tssrc/client/graphics/layers/MainRadialMenu.ts
📚 Learning: 2025-05-18T23:36:12.847Z
Learnt from: scottanderson
PR: openfrontio/OpenFrontIO#784
File: src/core/game/StatsImpl.ts:143-159
Timestamp: 2025-05-18T23:36:12.847Z
Learning: In this codebase, NukeType is a union type derived from specific UnitType enum values (AtomBomb, HydrogenBomb, MIRV, MIRVWarhead). This means that comparisons in switch statements between a NukeType parameter and UnitType enum values are valid and will work correctly at runtime.
Applied to files:
src/client/graphics/layers/BuildMenu.tssrc/client/graphics/layers/RadialMenuElements.ts
🧬 Code Graph Analysis (7)
tests/client/graphics/NukePreview.test.ts (1)
src/client/graphics/layers/NukePreview.ts (1)
NukePreview(8-292)
src/client/graphics/layers/NukePreview.ts (6)
src/client/graphics/layers/Layer.ts (1)
Layer(1-7)src/core/game/GameView.ts (1)
GameView(360-692)src/client/graphics/TransformHandler.ts (1)
TransformHandler(15-296)src/client/graphics/UIState.ts (1)
UIState(1-8)src/core/StatsSchemas.ts (1)
NukeType(11-15)src/core/game/Game.ts (1)
Cell(285-307)
tests/client/graphics/RadialMenuElements.test.ts (2)
src/core/game/GameView.ts (1)
PlayerView(180-358)src/client/graphics/layers/RadialMenuElements.ts (1)
attackMenuElement(428-439)
src/client/graphics/layers/RadialMenu.ts (1)
src/client/graphics/layers/RadialMenuElements.ts (1)
MenuElementParams(29-43)
src/client/graphics/layers/BuildMenu.ts (1)
src/client/graphics/UIState.ts (1)
UIState(1-8)
src/client/graphics/layers/RadialMenuElements.ts (2)
src/client/graphics/UIState.ts (1)
UIState(1-8)src/client/graphics/layers/BuildMenu.ts (1)
isNukeType(372-378)
src/client/graphics/GameRenderer.ts (1)
src/client/graphics/layers/NukePreview.ts (1)
NukePreview(8-292)
🔇 Additional comments (16)
src/client/graphics/layers/MainRadialMenu.ts (1)
133-134: Passing uiState to radial params is correctThis enables hover-driven preview toggles in menu items and keeps state shared across layers. Looks good.
src/client/graphics/GameRenderer.ts (3)
26-26: Adding NukePreview to the renderer is correctImport and registration look good and match the new layer’s constructor.
76-77: Wiring uiState into BuildMenu is correctEnsures build menu can dim and drive previews. Good.
274-275: Layer order: NukePreview after world layers is sensibleRendering the preview after terrain/units ensures it overlays the map while DOM-based UI stays above the canvas. Good placement.
tests/client/graphics/RadialMenuElements.test.ts (1)
150-155: Test params shape for uiState is fineStubbed UI state matches what the radial elements expect.
src/client/graphics/layers/RadialMenu.ts (3)
378-382: LGTM! Clean dimming implementation for nuclear previews.The
setMenuDimmethod provides a simple, focused way to dim the radial menu during nuclear hover states. The opacity value and transition timing align well with the build menu's dimming behavior.
408-409: Good integration with nuclear preview system.The hover enter logic correctly triggers dimming and invokes the item's hover callback when
isNukeis true, enabling coordinated preview rendering.
789-789: Good cleanup of dim state on menu hide.Properly resetting the dim state when hiding the menu ensures the UI remains consistent.
tests/client/graphics/NukePreview.test.ts (1)
1-144: Well-structured test coverage for nuclear preview rendering.The tests effectively verify both Atom Bomb and MIRV rendering paths with proper mocking and assertions. The deterministic time mocking ensures stable dash pattern calculations across test runs.
src/client/graphics/layers/RadialMenuElements.ts (2)
347-353: Clean nuclear type detection helper.The
isNukeTypefunction provides a clear, centralized way to identify nuclear units. This matches the pattern used in BuildMenu.ts.
415-424: Well-implemented hover handlers for nuclear previews.The hover enter/leave callbacks properly manage the UI state for nuclear previews, setting the active state and nuke type on hover and clearing it on leave.
src/client/graphics/layers/BuildMenu.ts (3)
157-158: Good anchor position storage for nuclear previews.Setting
nukeAnchorwhen showing the build menu ensures the preview system has the correct reference point for rendering.
380-399: Clean nuclear hover implementation with proper UI state management.The hover handlers correctly manage both the dimming state and the UI state's nuclear preview, ensuring coordinated behavior across components.
470-475: Efficient conditional hover handling for nuclear units.The pointer event handlers only trigger nuclear preview logic when the unit type is nuclear and enabled, avoiding unnecessary processing.
src/client/graphics/layers/NukePreview.ts (2)
1-24: Clean layer implementation with proper TypeScript patterns.The class structure follows good TypeScript practices with typed imports, clear interface implementation, and proper constructor parameter typing.
156-291: Excellent MIRV preview implementation with deterministic targeting.The MIRV rendering logic is well-structured with:
- Deterministic target generation using seeded random sampling
- Proper owner and terrain validation
- Efficient caching with signature-based invalidation
- Clear spacing constraints between targets
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (3)
src/client/graphics/layers/RadialMenu.ts (3)
443-443: Guard onHoverLeave call; remove non-null assertionNon-null assertion is unnecessary and flagged by ESLint. Also aligns with earlier feedback to ensure params is non-null before invoking callbacks.
Apply:
- d.data.onHoverLeave?.(this.params!); + if (this.params) { + d.data.onHoverLeave?.(this.params); + }
455-457: Guard onHoverLeave on click; remove non-null assertionSame issue as Line 443. Also satisfies the ESLint hint (“This assertion is unnecessary…”).
Apply:
- if (d.data.isNuke) this.setMenuDim(false); - d.data.onHoverLeave?.(this.params!); + if (d.data.isNuke) this.setMenuDim(false); + if (this.params) { + d.data.onHoverLeave?.(this.params); + }
408-410: Guard params before invoking onHoverEnter; avoid the castAvoid relying on the earlier disabled check; make the callback call explicit and remove the unnecessary type assertion.
Apply:
- if (d.data.isNuke) this.setMenuDim(true); - d.data.onHoverEnter?.(this.params as MenuElementParams); + if (d.data.isNuke) this.setMenuDim(true); + if (this.params) { + d.data.onHoverEnter?.(this.params); + }
🧹 Nitpick comments (4)
tests/client/graphics/RadialMenuElements.test.ts (1)
516-580: Broaden hover-preview tests to cover edge casesTwo useful additions:
- Add a Hydrogen Bomb case to ensure parity with Atom/MIRV.
- Verify that hovering a non-nuke does not clear an active preview set by a prior nuke hover (to prevent accidental preview reset due to out-of-order mouse events).
Example to add after your current tests:
it("does not clear active nukePreview on non-nuke hover leave", () => { const enemyPlayer = { id: () => 2, isPlayer: jest.fn(() => true) } as unknown as PlayerView; mockParams.selected = enemyPlayer; const subMenu = attackMenuElement.subMenu!(mockParams); const atom = subMenu.find((i) => i.id === "attack_Atom Bomb"); const warship = subMenu.find((i) => i.id === "attack_Warship"); atom!.onHoverEnter?.(mockParams); expect(mockParams.uiState.nukePreview?.nukeType).toBe(UnitType.AtomBomb); warship!.onHoverLeave?.(mockParams); // still active since the leave event was from a non-nuke item expect(mockParams.uiState.nukePreview?.nukeType).toBe(UnitType.AtomBomb); }); it("sets and clears nukePreview on hover for Hydrogen Bomb", () => { const enemyPlayer = { id: () => 2, isPlayer: jest.fn(() => true) } as unknown as PlayerView; mockParams.selected = enemyPlayer; const subMenu = attackMenuElement.subMenu!(mockParams); const hydro = subMenu.find((i) => i.id === "attack_Hydrogen Bomb"); expect(hydro).toBeDefined(); expect(hydro!.isNuke).toBe(true); hydro!.onHoverEnter?.(mockParams); expect(mockParams.uiState.nukePreview).toEqual({ active: true, nukeType: UnitType.HydrogenBomb }); hydro!.onHoverLeave?.(mockParams); expect(mockParams.uiState.nukePreview).toBeUndefined(); });src/client/graphics/layers/RadialMenu.ts (1)
378-383: Minor nit: comment typo and styleThe trailing parenthesis in the comment is stray.
Apply:
- .style("transition", "opacity 120ms ease"); // smooth like the build menu) + .style("transition", "opacity 120ms ease"); // smooth like the build menusrc/client/graphics/layers/RadialMenuElements.ts (2)
347-354: Avoid duplicate isNukeType definitions; centralize in one helperBuildMenu.ts already defines isNukeType. Duplicating here risks drift. Prefer a shared helper (e.g., src/client/graphics/Nuke.ts) and import it in both places.
Example:
// src/client/graphics/Nuke.ts import { UnitType } from "../../core/game/Game"; export const isNukeType = (t: UnitType) => t === UnitType.AtomBomb || t === UnitType.HydrogenBomb || t === UnitType.MIRV;Then:
// here and in BuildMenu.ts import { isNukeType } from "../Nuke";
27-27: Consider tightening UIState.nukePreview typing to NukeType (union of UnitType values)UIState defines nukeType as string, but you consistently use UnitType.* values (tests included). Prefer a precise union type to catch errors at compile time.
Additional change outside this file (UIState.ts):
// src/client/graphics/UIState.ts import { UnitType } from "../../core/game/Game"; export type NukeType = | UnitType.AtomBomb | UnitType.HydrogenBomb | UnitType.MIRV | UnitType.MIRVWarhead; export type UIState = { attackRatio: number; nukePreview?: { active: boolean; nukeType: NukeType; }; nukeAnchor?: { x: number; y: number }; };This keeps types aligned with how the rest of the code uses nuke types.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
📒 Files selected for processing (6)
src/client/graphics/GameRenderer.ts(4 hunks)src/client/graphics/layers/BuildMenu.ts(8 hunks)src/client/graphics/layers/MainRadialMenu.ts(2 hunks)src/client/graphics/layers/RadialMenu.ts(6 hunks)src/client/graphics/layers/RadialMenuElements.ts(6 hunks)tests/client/graphics/RadialMenuElements.test.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- src/client/graphics/layers/MainRadialMenu.ts
- src/client/graphics/GameRenderer.ts
- src/client/graphics/layers/BuildMenu.ts
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-06-16T03:03:59.778Z
Learnt from: VariableVince
PR: openfrontio/OpenFrontIO#1192
File: src/client/graphics/layers/RadialMenuElements.ts:312-314
Timestamp: 2025-06-16T03:03:59.778Z
Learning: In RadialMenuElements.ts, when fixing undefined params errors in subMenu functions, use explicit checks like `if (params === undefined || params.selected === null)` rather than optional chaining, as it makes the intent clearer and matches the specific error scenarios where params can be undefined during spawn phase operations.
Applied to files:
tests/client/graphics/RadialMenuElements.test.tssrc/client/graphics/layers/RadialMenu.ts
📚 Learning: 2025-05-18T23:36:12.847Z
Learnt from: scottanderson
PR: openfrontio/OpenFrontIO#784
File: src/core/game/StatsImpl.ts:143-159
Timestamp: 2025-05-18T23:36:12.847Z
Learning: In this codebase, NukeType is a union type derived from UnitType values (specifically bomb-related values like AtomBomb, HydrogenBomb, MIRV, and MIRVWarhead) rather than a separate enum. This means comparing NukeType values against UnitType values in switch statements is valid and intentional.
Applied to files:
src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-05-18T23:36:12.847Z
Learnt from: scottanderson
PR: openfrontio/OpenFrontIO#784
File: src/core/game/StatsImpl.ts:143-159
Timestamp: 2025-05-18T23:36:12.847Z
Learning: In this codebase, NukeType is a union type derived from specific UnitType enum values (AtomBomb, HydrogenBomb, MIRV, MIRVWarhead). This means that comparisons in switch statements between a NukeType parameter and UnitType enum values are valid and will work correctly at runtime.
Applied to files:
src/client/graphics/layers/RadialMenuElements.ts
🧬 Code Graph Analysis (3)
tests/client/graphics/RadialMenuElements.test.ts (2)
src/core/game/GameView.ts (1)
PlayerView(180-358)src/client/graphics/layers/RadialMenuElements.ts (1)
attackMenuElement(428-439)
src/client/graphics/layers/RadialMenu.ts (1)
src/client/graphics/layers/RadialMenuElements.ts (1)
MenuElementParams(29-43)
src/client/graphics/layers/RadialMenuElements.ts (1)
src/client/graphics/UIState.ts (1)
UIState(1-8)
🪛 GitHub Check: 🔍 ESLint
src/client/graphics/layers/RadialMenu.ts
[failure] 456-456:
This assertion is unnecessary since it does not change the type of the expression.
src/client/graphics/layers/RadialMenuElements.ts
[failure] 62-62:
Missing semicolon.
🔇 Additional comments (4)
tests/client/graphics/RadialMenuElements.test.ts (1)
151-155: LGTM: uiState scaffolding in test params is correctProviding attackRatio and the optional nukePreview/nukeAnchor aligns with the new MenuElementParams shape. This keeps tests realistic and future-proof.
src/client/graphics/layers/RadialMenu.ts (1)
789-790: LGTM: reset dimming on hideEnsures the overlay is undimmed on menu close, keeping UI state consistent.
src/client/graphics/layers/RadialMenuElements.ts (2)
41-41: LGTM: uiState added to MenuElementParamsPlumbing shared UI state into menu callbacks is the right surface for hover-driven previews.
386-386: LGTM: emit isNuke flag on menu itemsThis pairs cleanly with RadialMenu’s dimming and hover hooks.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/client/graphics/layers/RadialMenu.ts (2)
378-382: Solid helper; minor polish on transition and comment.The dimming helper is clean and easy to reuse. Two small tweaks:
- Set the transition once during element creation to avoid resetting it on every call.
- Fix the stray parenthesis in the comment.
Apply this diff here:
private setMenuDim(dim: boolean) { this.menuElement .style("opacity", dim ? "0.1" : "1") - .style("transition", "opacity 120ms ease"); // smooth like the build menu) + .style("transition", "opacity 120ms ease"); // smooth like the build menu }Optionally set the transition once in createMenuElement (outside the selected range):
// after creating this.menuElement in createMenuElement() this.menuElement.style("transition", "opacity 120ms ease");
408-410: GuardonHoverEnterwith an explicit params check to avoid the cast.You already gate earlier when disabled, but a direct guard keeps the types honest and matches our explicit-null-check style.
Apply this diff:
- if (d.data.isNuke) this.setMenuDim(true); - d.data.onHoverEnter?.(this.params as MenuElementParams); + if (d.data.isNuke) this.setMenuDim(true); + if (this.params) { + d.data.onHoverEnter?.(this.params); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
📒 Files selected for processing (6)
src/client/graphics/UIState.ts(1 hunks)src/client/graphics/layers/MainRadialMenu.ts(3 hunks)src/client/graphics/layers/NukePreview.ts(1 hunks)src/client/graphics/layers/PlayerActionHandler.ts(2 hunks)src/client/graphics/layers/RadialMenu.ts(6 hunks)src/client/graphics/layers/RadialMenuElements.ts(6 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
- src/client/graphics/layers/PlayerActionHandler.ts
- src/client/graphics/layers/MainRadialMenu.ts
- src/client/graphics/UIState.ts
- src/client/graphics/layers/RadialMenuElements.ts
- src/client/graphics/layers/NukePreview.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-16T03:03:59.778Z
Learnt from: VariableVince
PR: openfrontio/OpenFrontIO#1192
File: src/client/graphics/layers/RadialMenuElements.ts:312-314
Timestamp: 2025-06-16T03:03:59.778Z
Learning: In RadialMenuElements.ts, when fixing undefined params errors in subMenu functions, use explicit checks like `if (params === undefined || params.selected === null)` rather than optional chaining, as it makes the intent clearer and matches the specific error scenarios where params can be undefined during spawn phase operations.
Applied to files:
src/client/graphics/layers/RadialMenu.ts
🧬 Code Graph Analysis (1)
src/client/graphics/layers/RadialMenu.ts (1)
src/client/graphics/layers/RadialMenuElements.ts (1)
MenuElementParams(29-43)
🔇 Additional comments (4)
src/client/graphics/layers/RadialMenu.ts (4)
423-423: Good: undim on mouseout before early returns.Resetting dim state even when the handler bails keeps the UI consistent.
443-445: Nice fix: hover-leave callback now guarded by params.This addresses the prior null assertion risk and aligns with our explicit checks preference.
457-461: Good consistency: clear dim and guardonHoverLeaveon click.Prevents lingering dim state and avoids null assertions during click handling.
793-794: Correct reset of dim state when hiding the menu.Ensures the radial always returns to a clean state across close paths.
There was a problem hiding this comment.
- Please embed the videos/images directly into the PR description, instead of linking to them.
This ticket is not associated with its related issue. Please see https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue for details on how to link tickets properly.- The UI here is overly complex and visually busy, which I think will confuse players and lead to negative feedback. I’m not sure players are asking for all of this information.
|
@TheGiraffe3 @scottanderson
Please let me know if I've misunderstood your point, or you have another suggestion. |
scottanderson
left a comment
There was a problem hiding this comment.
@Dimitrije-V sorry I thought this was for the ticket in the current release related to showing SAM protection radius. Please come talk to us in discord about this feature.
|
This feature is similar to #1157 although they are a little bit different in what information they provide. |
|
i agree with @Dimitrije-V. Nuke preview feature really removes the depth of the game a little |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (8)
src/client/graphics/layers/NukePreview.ts (8)
49-56: Make MIRV seed deterministic per (type, anchor, owner) as designedRight now
_npSeedchanges only with(type, anchor). The MIRV target set is re-generated when owner changes, but it still uses the old seed. To fully match “deterministic per (type, anchor, owner)”, include owner in the seed signature when MIRV is active.- const sig = `${p.nukeType}|${anchor.x}|${anchor.y}`; + const sig = + p.nukeType === UnitType.MIRV + ? (() => { + const o = this.game.owner(this.game.ref(anchor.x, anchor.y)); + const ownerKey = o.isPlayer() ? (o as any).id() : "TN"; + return `${p.nukeType}|${anchor.x}|${anchor.y}|${ownerKey}`; + })() + : `${p.nukeType}|${anchor.x}|${anchor.y}`; if (this._npSig !== sig) { this._npSig = sig; this._npSeed = this.game.ticks(); }
8-10: Upgrade helper to a type guard for better narrowingTurn
isNukeTypeinto a type guard so callers get narrowed types (clean, idiomatic TS).-export const isNukeType = (t: UnitType) => - t === UnitType.AtomBomb || t === UnitType.HydrogenBomb || t === UnitType.MIRV; +export const isNukeType = ( + t: UnitType, +): t is Exclude<NukeType, UnitType.MIRVWarhead> => + t === UnitType.AtomBomb || t === UnitType.HydrogenBomb || t === UnitType.MIRV;
97-119: Reduce per-frame work in probabilistic band (cache tiles per signature)This double loop does thousands of
worldToScreenCoordinatescalls andfillRects every frame. Since the band is stable per(type, anchor, seed), precompute the list of band tiles once per_npSigand reuse during render.Happy to sketch a small cache like
_bandFill: Array<{px:number;py:number;size:number}>keyed by_npSig.
183-185: Compare owner by ID, not by object identity
owner !== anchorOwnermay fail even for the same player if different object instances are returned. Compare stable IDs (or small IDs).- const owner = this.game.owner(tile); - if (owner !== anchorOwner) continue; + const owner = this.game.owner(tile); + const anchorOwnerId = anchorOwner.isPlayer() ? (anchorOwner as any).id() : -1; + const ownerId = owner.isPlayer() ? (owner as any).id() : -1; + if (ownerId !== anchorOwnerId) continue;
146-150: Avoid magic numbers: derive MIRV constants from config or shared constantsHardcoding
MIRV_RANGE = 1500andMIN_SPACING = 25may drift from server/game logic. Prefer reading from config, or import a shared constant (e.g., MirvExecution.mirvRange, proximity spacing).Example:
- Read
mirvRangefrom config.- Export a single source of truth for proximity/spacings.
112-117: Pixel snapping for crisper rectanglesWhen
tileStep > 1or at fractional scales,fillRectat fractionalpx/pycan blur. Snap to device pixels.- const px = pt.x - rect.left; - const py = pt.y - rect.top; + const px = Math.round(pt.x - rect.left) + 0.5; + const py = Math.round(pt.y - rect.top) + 0.5;Note: also consider rounding
sizeto avoid gaps.
237-255: Draw once, fill and stroke the same pathYou create two arcs for the same circle. Use one path, fill then stroke for a small perf win.
- ctx.beginPath(); - ctx.setLineDash([]); - ctx.lineWidth = opts.strokeWidth; - ctx.strokeStyle = opts.stroke; - ctx.arc(cx, cy, r, 0, Math.PI * 2); - ctx.stroke(); - - ctx.beginPath(); - ctx.fillStyle = opts.fill; - ctx.arc(cx, cy, r, 0, Math.PI * 2); - ctx.fill(); + ctx.beginPath(); + ctx.setLineDash([]); + ctx.arc(cx, cy, r, 0, Math.PI * 2); + ctx.fillStyle = opts.fill; + ctx.fill(); + ctx.lineWidth = opts.strokeWidth; + ctx.strokeStyle = opts.stroke; + ctx.stroke();
141-145: Consistent visual padding for outer boundaryThe single-blast safety line uses a padding based on
tileStep; MIRV uses a fixed-1. Consider harmonizing the padding logic for visual consistency at different zoom levels.Also applies to: 221-229
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
src/client/graphics/layers/NukePreview.ts(1 hunks)src/client/graphics/layers/PlayerActionHandler.ts(3 hunks)src/client/graphics/layers/RadialMenu.ts(6 hunks)src/client/graphics/layers/RadialMenuElements.ts(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- src/client/graphics/layers/PlayerActionHandler.ts
- src/client/graphics/layers/RadialMenuElements.ts
- src/client/graphics/layers/RadialMenu.ts
🧰 Additional context used
🧬 Code graph analysis (1)
src/client/graphics/layers/NukePreview.ts (6)
src/client/graphics/layers/Layer.ts (1)
Layer(1-7)src/core/game/GameView.ts (1)
GameView(360-692)src/client/graphics/TransformHandler.ts (1)
TransformHandler(15-296)src/client/graphics/UIState.ts (1)
UIState(3-10)src/core/StatsSchemas.ts (1)
NukeType(11-15)src/core/game/Game.ts (1)
Cell(285-307)
🔇 Additional comments (2)
src/client/graphics/layers/NukePreview.ts (2)
31-43: Nice: deterministic PRNG and small, typed helpersThe
h32+rand01approach is clean and deterministic, with unsigned return. Good foundation for stable previews.
65-128: Overall: solid composition, clear separation of MIRV vs single-blast, correct transform usageLayer stays untransformed, converts world→screen precisely, and restores context. Readability is good and sticks to simple TypeScript.
Also applies to: 130-234
| if (p.nukeType === "MIRV") { | ||
| this.renderMirvPreview(ctx, anchor.x, anchor.y, seed); | ||
| return; | ||
| } | ||
|
|
||
| this.renderSingleBlastPreview(ctx, anchor.x, anchor.y, p.nukeType as NukeType, seed); | ||
| } |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Bug: MIRV type compared to string instead of enum
This branch will never trigger if UnitType is an enum (very likely), so MIRV previews won’t render. Compare against UnitType.MIRV.
- if (p.nukeType === "MIRV") {
+ if (p.nukeType === UnitType.MIRV) {
this.renderMirvPreview(ctx, anchor.x, anchor.y, seed);
return;
}Run to find any other string comparisons:
🏁 Script executed:
#!/bin/bash
rg -nP -C2 '===\s*["'\''](?:MIRV|AtomBomb|HydrogenBomb)["'\'']' src -g '!**/node_modules/**'Length of output: 459
Use the UnitType.MIRV enum constant instead of the string literal
The check p.nukeType === "MIRV" will never succeed when UnitType is an enum (whether numeric or string-backed). Swap it for the enum value to ensure the MIRV preview renders correctly.
• File: src/client/graphics/layers/NukePreview.ts
Line: 57
• Diff to apply:
- if (p.nukeType === "MIRV") {
+ if (p.nukeType === UnitType.MIRV) {
this.renderMirvPreview(ctx, anchor.x, anchor.y, seed);
return;
}• I searched for any other literal comparisons of MIRV, AtomBomb, or HydrogenBomb via:
rg -nP -C2 '===\s*["'"'"'](?:MIRV|AtomBomb|HydrogenBomb)["'"'"']' src -g '!**/node_modules/**'and found no additional instances in src.
🤖 Prompt for AI Agents
In src/client/graphics/layers/NukePreview.ts around lines 57 to 63, the check
currently compares p.nukeType to the string literal "MIRV", which will never
match when UnitType is an enum; replace the string literal with the enum
constant UnitType.MIRV, ensure UnitType is imported in this file (add an import
if missing), and keep the rest of the conditional flow the same so
renderMirvPreview is called when p.nukeType === UnitType.MIRV.
## Description: New FX played to preview the nuke explosion area (follow up of #2309) Will prevent over-nuking the same area in team games  Visuals inspired from #1814 (@ryanbarlow97) ## 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 ## Please put your Discord username so you can be contacted if a bug or regression is found: IngloriousTom --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Thank you for this pr |
Hi, no problem, I had things going on and there seemed to be a lot of indecision and debate about the feature at the time, so I gave up on it. Glad to see some of it made it in. |
Description:
This PR adds interactive nuke previews (Atom, Hydrogen, MIRV) to the build & radial menus, and dims the UI while previewing so players can aim with confidence.
What’s included
(src/client/graphics/layers/NukePreview.ts)UIStateextended to contain:NukePreviewlayer and providesuiState.uiState.nukeAnchorto the clicked world tile when the menu opens.uiState.nukePreviewand adds a subtle “dim” state to the menu; clears on leave/close.uiStateinMenuElementParams.createMenuElements: marks nukes (isNuke) and providesonHoverEnter/onHoverLeaveto set/clearuiState.nukePreview.uiState.nukeAnchorwhen opening on a tile.You can see what this looks like here:
Atom.mp4
Hydro.mp4
MIRV.mp4
Build.Menu.mp4
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
.dimitrije