Change plane weight capacity from static 6 package to real weight of package - package weight and distance is related to job payout. #45

Closed
opened 2026-09-20 10:54:54 +02:00 by kamilkrzywda · 1 comment
Owner
No description provided.
Author
Owner

Done in v0.27.0 (PR #52, merge commit b2133fd, deployed to https://flight.dev.kkhost.pl).

What changed:

  • Packages now carry a real weight (weightKg): drawn at generation as per-cargo-type unit weight × count × jitter (new tunable UNIT_WEIGHT_KG table in seed.ts; DB column + guarded migration).
  • Plane capacity is now max payload instead of the static 6 slots: ATR 72-600 = 4,800 kg (capacity field removed from catalog/snapshot/OpenAPI).
  • Load validation (server + client) sums package weights against max payload — server rejects with "no payload room: … carries X/Y kg"; the left-pane loadout now shows tonnage (e.g. 1.2t / 4.8t). Client eligibility mirrors the server check exactly, so a near-full plane never shows an enabled Load that fails.
  • Payout now depends on weight and distance: reward = round(500 + 2.5·km + 0.5·weightKg) (REWARD_PER_KG = 0.5; typical hops stay in the €1–3k band).
  • Fuel burn math untouched — cargo weight does not enter fuel consumption yet (possible follow-up if you want it).

Verified: full unit suite green, e2e in CI (run #95), prod /api/version = 0.27.0.

Done in **v0.27.0** (PR #52, merge commit `b2133fd`, deployed to https://flight.dev.kkhost.pl). What changed: - Packages now carry a real weight (`weightKg`): drawn at generation as per-cargo-type unit weight × count × jitter (new tunable `UNIT_WEIGHT_KG` table in seed.ts; DB column + guarded migration). - Plane capacity is now **max payload** instead of the static 6 slots: ATR 72-600 = 4,800 kg (`capacity` field removed from catalog/snapshot/OpenAPI). - Load validation (server + client) sums package weights against max payload — server rejects with "no payload room: … carries X/Y kg"; the left-pane loadout now shows tonnage (e.g. `1.2t / 4.8t`). Client eligibility mirrors the server check exactly, so a near-full plane never shows an enabled Load that fails. - Payout now depends on weight **and** distance: `reward = round(500 + 2.5·km + 0.5·weightKg)` (REWARD_PER_KG = 0.5; typical hops stay in the €1–3k band). - Fuel burn math untouched — cargo weight does not enter fuel consumption yet (possible follow-up if you want it). Verified: full unit suite green, e2e in CI (run #95), prod `/api/version` = 0.27.0.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/Flight-Ops#45