Skip to content

Include in-transit ship cargo in burn calculations#44

Merged
jackinabox86 merged 1 commit into
mainfrom
claude/ship-inventory-burn-calc-Qlk3P
May 24, 2026
Merged

Include in-transit ship cargo in burn calculations#44
jackinabox86 merged 1 commit into
mainfrom
claude/ship-inventory-burn-calc-Qlk3P

Conversation

@jackinabox86

Copy link
Copy Markdown
Owner

Summary

  • Adds getInTransitShipCargo(siteAddress) to core/burn.ts — finds all ships with an active flight whose destination planet matches the site's planet, and returns their combined SHIP_STORE contents as a ticker→amount map
  • calculateSiteBurn now merges that in-transit cargo into the inventory before computing inventoryAmount and daysRemaining, so burn times reflect resupply shipments already underway
  • Cargo stops counting the moment the ship lands (flightId becomes null), matching refined-prun's behaviour

Planet matching uses extractPlanetNaturalId on both the flight destination and the site address (ID-agnostic; the game can issue fresh address entity IDs for the same planet).

Test plan

  • getInTransitShipCargo unit tests: empty stores, docked ship excluded, wrong-destination ship excluded, matching ship included, two matching ships summed, station address (no planet) returns empty
  • calculateSiteBurn integration tests: in-transit cargo extends daysRemaining; wrong-destination ship has no effect; docked ship has no effect
  • Full test suite passes (pnpm test --run) — 400 tests, 0 failures

Generated by Claude Code

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.
@jackinabox86 jackinabox86 marked this pull request as ready for review May 24, 2026 18:49
@jackinabox86 jackinabox86 merged commit 8dba0d2 into main May 24, 2026
2 checks passed
@jackinabox86 jackinabox86 deleted the claude/ship-inventory-burn-calc-Qlk3P branch May 24, 2026 20:15
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.

2 participants