Improvement: Excluded Space Station Capacities from Transport Cost Calculations#8500
Conversation
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
All capacity getters have been replaced. HangarStatistics does not leave room for exclusion of certain unit types.
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
HangarStatisticsmethods 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.
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… into spaceStationTravelContributions # Conflicts: # MekHQ/src/mekhq/campaign/mission/TransportCostCalculations.java
|
All copilot feedback has been accounted for |
# Conflicts: # MekHQ/unittests/mekhq/campaign/mission/TransportCostCalculationsTest.java
Space Station Travel Rules Excerts
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'.