Include in-transit ship cargo in burn calculations#44
Merged
Conversation
When a ship has an active flight whose destination planet matches a base's planet, its SHIP_STORE cargo is now counted in that base's burn inventory. This extends daysRemaining to reflect resupply shipments already underway. Cargo stops counting once the ship lands (flightId becomes null). Matches the behaviour in refined-prun where inbound ship cargo counts toward burn until the ship docks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getInTransitShipCargo(siteAddress)tocore/burn.ts— finds all ships with an active flight whose destination planet matches the site's planet, and returns their combinedSHIP_STOREcontents as a ticker→amount mapcalculateSiteBurnnow merges that in-transit cargo into the inventory before computinginventoryAmountanddaysRemaining, so burn times reflect resupply shipments already underwayflightIdbecomesnull), matching refined-prun's behaviourPlanet matching uses
extractPlanetNaturalIdon both the flight destination and the site address (ID-agnostic; the game can issue fresh address entity IDs for the same planet).Test plan
getInTransitShipCargounit tests: empty stores, docked ship excluded, wrong-destination ship excluded, matching ship included, two matching ships summed, station address (no planet) returns emptycalculateSiteBurnintegration tests: in-transit cargo extendsdaysRemaining; wrong-destination ship has no effect; docked ship has no effectpnpm test --run) — 400 tests, 0 failuresGenerated by Claude Code