Skip to content

Introduce CurrentLocationPanel and TransitStatusChangedEvent#9092

Merged
psikomonkie merged 2 commits into
MegaMek:mainfrom
hokvel:location-panel
May 25, 2026
Merged

Introduce CurrentLocationPanel and TransitStatusChangedEvent#9092
psikomonkie merged 2 commits into
MegaMek:mainfrom
hokvel:location-panel

Conversation

@hokvel
Copy link
Copy Markdown
Contributor

@hokvel hokvel commented May 25, 2026

This change introduces a brand new CurrentLocationPanel that displays a location image, planetary conditions, socio-industrial data, travel progress, jump costs, and the hiring hall button. Additionally, it takes a stab at a cleaner separation of event processing and domain logic versus the UI layer, simplifies AbstractLocation and CampaignGUI logic.

Detailed changes:

  • AbstractLocation.getReport separated into more specific methods (getTitle, getPlanetaryConditionsInfo, getCourseInfo, getJumpCostInfo, getSocioIndustrialInfo) and moved to CurrentLocationPanel
  • Hiring Hall button moved from the Marketplace panel to the CurrentLocationPanel, conditionally enabling based on its availability
  • Planetary conditions surfaced in the UI including highlighting based on modifiers they provide
  • Introduced TransitStatusChangedEvent to broadcast in-system transit ticks, jump path alterations, and jumpship charging progress
  • Removed manual UI updates, simplifying CampaignGUI and other map views by relying on event subscriptions
  • Renamed the GM charging action from setRecharged() to chargeFully()
  • Improved test coverage for CurrentLocation, notably for newDay
  • Switched to campaign.isUseCommandCircuit() calls where possible

This change introduces a brand new `CurrentLocationPanel` that
displays a location image, planetary conditions, socio-industrial
data, travel progress, jump costs, and the hiring hall button.
Additionally, it takes a stab at a cleaner separation of event
processing and domain logic versus the UI layer, simplifies
`AbstractLocation` and `CampaignGUI` logic.

Detailed changes:
- `AbstractLocation.getReport` separated into more specific methods
  (`getTitle`, `getPlanetaryConditionsInfo`, `getCourseInfo`,
  `getJumpCostInfo`, `getSocioIndustrialInfo`) and moved to
  `CurrentLocationPanel`
- Hiring Hall button moved from the Marketplace panel to the
  `CurrentLocationPanel`, conditionally enabling based on its
  availability
- Planetary conditions surfaced in the UI including highlighting
  based on modifiers they provide
- Introduced `TransitStatusChangedEvent` to broadcast in-system
  transit ticks, jump path alterations, and jumpship charging
  progress
- Removed manual UI updates, simplifying `CampaignGUI` and other
  map views by relying on event subscriptions
- Renamed the GM charging action from `setRecharged()` to
  `chargeFully()`
- Improved test coverage for `CurrentLocation`, notably for `newDay`
- Switched to `campaign.isUseCommandCircuit()` calls where possible
@hokvel hokvel requested a review from a team as a code owner May 25, 2026 06:53
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 3.74532% with 257 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.22%. Comparing base (969d837) to head (627c858).
⚠️ Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
MekHQ/src/mekhq/gui/view/CurrentLocationPanel.java 0.00% 180 Missing ⚠️
...rc/mekhq/gui/baseComponents/VerticalFillImage.java 0.00% 63 Missing ⚠️
MekHQ/src/mekhq/gui/CampaignGUI.java 0.00% 8 Missing ⚠️
MekHQ/src/mekhq/campaign/CurrentLocation.java 70.00% 2 Missing and 1 partial ⚠️
MekHQ/src/mekhq/campaign/AbstractLocation.java 0.00% 1 Missing ⚠️
...khq/campaign/events/TransitStatusChangedEvent.java 75.00% 1 Missing ⚠️
MekHQ/src/mekhq/gui/InterstellarMapPanel.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9092      +/-   ##
============================================
+ Coverage     15.21%   15.22%   +0.01%     
- Complexity     9296     9330      +34     
============================================
  Files          1304     1308       +4     
  Lines        172561   173079     +518     
  Branches      26080    26165      +85     
============================================
+ Hits          26254    26354     +100     
- Misses       143260   143669     +409     
- Partials       3047     3056       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

// Handle current location and travel status change events

@Subscribe
public void handleLocationChanged(LocationChangedEvent e) {
}

@Subscribe
public void handleTransitStatusChanged(TransitStatusChangedEvent e) {
@psikomonkie psikomonkie self-assigned this May 25, 2026
Copy link
Copy Markdown
Member

@psikomonkie psikomonkie left a comment

Choose a reason for hiding this comment

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

Nice! I love the new CurrentLocationPanel! I'm glad that inside CurrentLocationPanel it uses AbstractLocation.

Two requested changes, but otherwise I think this looks great.

Thanks!

Comment thread MekHQ/src/mekhq/campaign/events/TransitStatusChangedEvent.java Outdated
Comment thread MekHQ/unittests/mekhq/campaign/CurrentLocationTest.java
@psikomonkie psikomonkie self-requested a review May 25, 2026 21:39
Copy link
Copy Markdown
Member

@psikomonkie psikomonkie left a comment

Choose a reason for hiding this comment

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

Excellent, thanks for getting those changes in quick, hokvel! This is approved!

@psikomonkie psikomonkie merged commit 696bca7 into MegaMek:main May 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants