Skip to content

Improvement: Excluded Space Station Capacities from Transport Cost Calculations#8500

Merged
IllianiBird merged 6 commits intoMegaMek:mainfrom
IllianiBird:spaceStationTravelContributions
Dec 14, 2025
Merged

Improvement: Excluded Space Station Capacities from Transport Cost Calculations#8500
IllianiBird merged 6 commits intoMegaMek:mainfrom
IllianiBird:spaceStationTravelContributions

Conversation

@IllianiBird
Copy link
Collaborator

Space Station Travel Rules Excerts

image image image

This PR

This PR excludes Space Station capacities (both bay and passenger) from consideration when calculating jump costs. This is done for the following reasons:

Space Stations must be fully shut down when jumping. While the rules are silent on whether this includes life support, CamOps explicitly excludes Space Stations from including their crew capacities in transport calculations. Furthermore, CamOps pg 35 does not include Space Stations in the list of 'transport units'.

@IllianiBird IllianiBird self-assigned this Dec 13, 2025
@IllianiBird IllianiBird requested a review from a team as a code owner December 13, 2025 23:36
@IllianiBird IllianiBird added Bug Severity: Medium Issues described as medium severity as per the new issue form Implementation of Missing Official Rule Used with the RFE tag for the implementation of missing official rule labels Dec 13, 2025
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I went ahead and redone a bunch of these tests to account for use of the new getters

countUnitsByType();
calculateAdditionalBayRequirementsFromUnits();
calculateAdditionalBayRequirementsFromPassengers(hangarStatistics.getTotalLargeCraftPassengerCapacity());
calculateAdditionalBayRequirementsFromPassengers(getTotalLargeCraftPassengerCapacity());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All capacity getters have been replaced. HangarStatistics does not leave room for exclusion of certain unit types.

@codecov
Copy link

codecov bot commented Dec 13, 2025

Codecov Report

❌ Patch coverage is 69.23077% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 12.28%. Comparing base (cee6d1d) to head (83ea9bf).
⚠️ Report is 54 commits behind head on main.

Files with missing lines Patch % Lines
...hq/campaign/mission/TransportCostCalculations.java 69.23% 24 Missing and 12 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8500      +/-   ##
============================================
+ Coverage     12.25%   12.28%   +0.03%     
- Complexity     7363     7393      +30     
============================================
  Files          1286     1286              
  Lines        165097   165218     +121     
  Branches      24823    24857      +34     
============================================
+ Hits          20227    20304      +77     
- Misses       142948   142979      +31     
- Partials       1922     1935      +13     

☔ 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements the exclusion of Space Station capacities from transport cost calculations to comply with CamOps rules, which require Space Stations to be fully shut down when jumping. The changes introduce new helper methods to calculate bay capacities and passenger counts while filtering out Space Stations.

  • Replaced direct calls to HangarStatistics methods with new local methods that filter Space Stations
  • Added comprehensive test coverage with helper methods for unit creation and hangar setup
  • Refactored tests to use actual Unit/Entity mocks instead of mocking HangarStatistics

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 25 comments.

File Description
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java Added 10 new methods (getTotalSmallCraftBays, getTotalASFBays, etc.) that calculate transport capacities while filtering out Space Stations; updated existing methods to call these new helpers
MekHQ/unittests/mekhq/campaign/mission/TransportCostCalculationsTest.java Refactored test setup to mock Hangar instead of HangarStatistics; added helper methods for creating test units; added test to verify Space Station filtering; updated all bay requirement tests to use new approach

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

IllianiBird and others added 3 commits December 13, 2025 17:52
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… into spaceStationTravelContributions

# Conflicts:
#	MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
@IllianiBird
Copy link
Collaborator Author

All copilot feedback has been accounted for

Copy link
Collaborator

@Sleet01 Sleet01 left a comment

Choose a reason for hiding this comment

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

LGTM

# Conflicts:
#	MekHQ/unittests/mekhq/campaign/mission/TransportCostCalculationsTest.java
@IllianiBird IllianiBird merged commit 3227ddc into MegaMek:main Dec 14, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Implementation of Missing Official Rule Used with the RFE tag for the implementation of missing official rule Severity: Medium Issues described as medium severity as per the new issue form

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants