Weight-based cargo capacity + weight/distance payout (ISS-045) #52

Merged
kamilkrzywda merged 1 commits from feat/weight-capacity-payout into master 2026-09-20 14:54:55 +02:00
Owner

Issue #45 — replace the static 6-package slot capacity with real package weights, and make payout depend on weight as well as distance.

Changes:

  • Packages now carry a real weightKg (drawn at generation: per-cargo-type unit weight × count × jitter; new tunable UNIT_WEIGHT_KG table in seed.ts). DB column + guarded migration.
  • Plane capacity is now maxPayloadKg (ATR 72-600 = 4800 kg) instead of the static capacity: 6 slot count — removed from catalog/snapshot/OpenAPI.
  • Load validation (server + client) sums package weights against max payload; 409 "no payload room" message with tonnage. Client eligibility mirrors the server check exactly so a near-full plane never shows an enabled Load that 409s.
  • Payout: reward = round(BASE_REWARD + REWARD_PER_KM·km + REWARD_PER_KG·weightKg) (REWARD_PER_KG = 0.5; typical hops stay in the €1–3k band).
  • Left-pane loadout display now shows tonnage (1.2t / 4.8t).
  • Fuel burn math untouched (cargo weight does not enter burn — possible follow-up).
  • OpenAPI updated (PackageState.weightKg, CatalogEntry swap); no new endpoints → path list unchanged.

Version 0.26.0 → 0.27.0.

Issue #45 — replace the static 6-package slot capacity with real package weights, and make payout depend on weight as well as distance. Changes: - Packages now carry a real `weightKg` (drawn at generation: per-cargo-type unit weight × count × jitter; new tunable `UNIT_WEIGHT_KG` table in seed.ts). DB column + guarded migration. - Plane capacity is now `maxPayloadKg` (ATR 72-600 = 4800 kg) instead of the static `capacity: 6` slot count — removed from catalog/snapshot/OpenAPI. - Load validation (server + client) sums package weights against max payload; 409 "no payload room" message with tonnage. Client eligibility mirrors the server check exactly so a near-full plane never shows an enabled Load that 409s. - Payout: `reward = round(BASE_REWARD + REWARD_PER_KM·km + REWARD_PER_KG·weightKg)` (REWARD_PER_KG = 0.5; typical hops stay in the €1–3k band). - Left-pane loadout display now shows tonnage (`1.2t / 4.8t`). - Fuel burn math untouched (cargo weight does not enter burn — possible follow-up). - OpenAPI updated (PackageState.weightKg, CatalogEntry swap); no new endpoints → path list unchanged. Version 0.26.0 → 0.27.0.
kamilkrzywda added 1 commit 2026-09-20 14:46:51 +02:00
Package weight, payload capacity and per-kg payout (ISS-045)
CI / build + unit + e2e (pull_request) Successful in 8m2s
179fad450d
Packages carry a real weightKg (unit weight x count with +/-30% jitter),
plane capacity becomes maxPayloadKg instead of 6 slots, load validation
sums cargo weight against the payload, and the payout gains a per-kg part.
Loadout display shows tonnage; OpenAPI swaps CatalogEntry.capacity for
maxPayloadKg and adds PackageState.weightKg.
kamilkrzywda scheduled this pull request to auto merge when all checks succeed 2026-09-20 14:47:00 +02:00
kamilkrzywda merged commit b2133fd25c into master 2026-09-20 14:54:55 +02:00
kamilkrzywda deleted branch feat/weight-capacity-payout 2026-09-20 14:54:55 +02:00
Sign in to join this conversation.