Skip to content

Cleanup: remove unused code from four files#3234

Merged
DevelopingTom merged 1 commit intomainfrom
remove-unused
Feb 18, 2026
Merged

Cleanup: remove unused code from four files#3234
DevelopingTom merged 1 commit intomainfrom
remove-unused

Conversation

@VariableVince
Copy link
Contributor

@VariableVince VariableVince commented Feb 18, 2026

Description:

PR 2/x in effort to break up PR #3220. Follows on #3233. Precedes #3235.

Please see if these can be merged for v30.

Removes unused code and properties.

  • Game.ts and DefaultConfig unitInfo: removed canBuildTrainStation and expirimental properties, as they weren't used anywhere anymore.

  • PlayerActionHandler: remove unused getPlayerActions, the only potential caller MainRadialMenu already just calls myPlayer.actions via GameView directly.

  • StructureIconsLayer: remove unused PlayerActions

Please complete the following:

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

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

tryout33

@VariableVince VariableVince self-assigned this Feb 18, 2026
@VariableVince VariableVince requested a review from a team as a code owner February 18, 2026 19:10
@VariableVince VariableVince added the Refactor Code cleanup, technical debt, refactoring, and architecture improvements. label Feb 18, 2026
@VariableVince VariableVince added this to the v30 milestone Feb 18, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

Walkthrough

This pull request removes PlayerActions-related code from graphics layers and eliminates two optional metadata properties (canBuildTrainStation and experimental) from the UnitInfo interface and its default configuration, simplifying the unit system.

Changes

Cohort / File(s) Summary
Player Action Removal
src/client/graphics/layers/PlayerActionHandler.ts, src/client/graphics/layers/StructureIconsLayer.ts
Removed PlayerActions import, public playerActions property, and getPlayerActions() method from graphics layers.
UnitInfo Property Cleanup
src/core/game/Game.ts, src/core/configuration/DefaultConfig.ts
Removed canBuildTrainStation and experimental optional properties from UnitInfo interface and removed corresponding property assignments from City, Factory, Port, and Train unit configurations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🧹 Clean slate for units, no trains to explore,
Experimental flags fade out the door,
Layers grow lighter, actions removed,
Simple and focused, the codebase improved. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing unused code from multiple files as part of a refactoring effort.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The description clearly explains the purpose of removing unused code and properties across four files, matching the actual changeset.

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


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

❤️ Share

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

Copy link
Contributor

@DevelopingTom DevelopingTom left a comment

Choose a reason for hiding this comment

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

Thanks!

@github-project-automation github-project-automation bot moved this from Triage to Final Review in OpenFront Release Management Feb 18, 2026
@DevelopingTom DevelopingTom added this pull request to the merge queue Feb 18, 2026
Merged via the queue into main with commit 52036cc Feb 18, 2026
15 of 16 checks passed
@DevelopingTom DevelopingTom deleted the remove-unused branch February 18, 2026 20:19
@github-project-automation github-project-automation bot moved this from Final Review to Complete in OpenFront Release Management Feb 18, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 18, 2026
## Description:

PR 3/x in effort to break up PR
#3220. Follows on already
merged #3233 and
#3234.

Please see if these can be merged for v30.

- **ClientGameRunner**: removed two redundant myPlayer===null checks
since that was already done right above, instead use !.
- **BuildMenu**: just like in UnitDisplay, assign public PlayerActions
default value of null. So that in canCreateOrBuild, where we already do
a === null check on it btw, we can safely skip the assignment to const
buildableUnits and just directly loop over
this.playerActions.buildableUnits.
- **RadialMenuElements**: don't call canBuildOrUpgrade 3x in
CreateMenuElements for the .map on flattenedBuildTable, instead do it
once and re-use outcome.

## 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:

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

Labels

Refactor Code cleanup, technical debt, refactoring, and architecture improvements.

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

2 participants

Comments