Broken planes cannot fly; repair heals gradually (ISS-089)
CI / build + unit + e2e (pull_request) Successful in 8m22s
CI / build + unit + e2e (pull_request) Successful in 8m22s
- flyPlane 409s a broken plane (health <= 0) before any refuel math — fuel/cash untouched - engine auto-chain skips chaining when a landing's wear breaks the plane (queue kept intact) - finishRepairs heals along round(f x 100) each tick; flip to available at exactly 100 on gate pass - repairPlane no longer jumps health to 100 — it starts the gradual heal - REMOVED BROKEN_BURN_MULTIPLIER / conditionBurnMultiplier and all burn sites (unreachable now) - OpenAPI + route comments reworded; unit tests reworked; e2e maintenance.spec.ts per issue - v0.45.0
This commit is contained in:
@@ -6,7 +6,7 @@ import { initialBearingDeg } from '../lib/geo';
|
||||
import { weatherFor } from '../lib/weather';
|
||||
import { fuelAtWeighted, windBurnFactor } from '../lib/sim/movement';
|
||||
// v0.38.0 (ISS-072) — reputation discounts: expectations computed from the LIVE snapshot's rep with the real helpers.
|
||||
import { conditionBurnMultiplier, FUEL_DISCOUNT_PER_REP, MAX_FUEL_DISCOUNT, MAX_PLANE_DISCOUNT, PLANE_DISCOUNT_PER_REP, repRate } from '../lib/game/catalog';
|
||||
import { FUEL_DISCOUNT_PER_REP, MAX_FUEL_DISCOUNT, MAX_PLANE_DISCOUNT, PLANE_DISCOUNT_PER_REP, repRate } from '../lib/game/catalog';
|
||||
import { STARTING_REPUTATION } from '../lib/game/seed';
|
||||
|
||||
// v0.12.0 — right Jobs & Market pane against the live origin: open packages render with
|
||||
@@ -27,7 +27,7 @@ interface PlaneState {
|
||||
status: 'available' | 'flying';
|
||||
fuel: number;
|
||||
maxFuel: number;
|
||||
health: number; // v0.39.0 (ISS-069) — feeds conditionBurnMultiplier in the auto-refuel math
|
||||
health: number; // v0.39.0 (ISS-069) — structural health; flyHomeViaApi restores it to 100 before each test
|
||||
locationIcao: string;
|
||||
destIcao: string | null;
|
||||
}
|
||||
@@ -389,11 +389,11 @@ test('dispatch auto-refuels: a low tank tops up to 150% of the leg requirement a
|
||||
expect(starter.fuel).toBe(LOW_FUEL); // the hook stuck
|
||||
|
||||
// Expected top-up from the snapshot constants — mirrors flyPlane's math (lib/game/actions.ts):
|
||||
// wind-adjusted requirement × condition multiplier, 150% margin capped at tank capacity.
|
||||
// wind-adjusted requirement, 150% margin capped at tank capacity.
|
||||
const km = haversineKm(nearest.hubLat, nearest.hubLon, nearest.lat, nearest.lon);
|
||||
const wHub = weatherFor(HUB);
|
||||
const required = requiredFuelFor(
|
||||
entry.burnPerKm * windBurnFactor(wHub.windKt, wHub.windDirDeg, initialBearingDeg(nearest.hubLat, nearest.hubLon, nearest.lat, nearest.lon)) * conditionBurnMultiplier(starter.health),
|
||||
entry.burnPerKm * windBurnFactor(wHub.windKt, wHub.windDirDeg, initialBearingDeg(nearest.hubLat, nearest.hubLon, nearest.lat, nearest.lon)),
|
||||
entry.emptyWeightKg,
|
||||
entry.maxFuel,
|
||||
km,
|
||||
@@ -424,7 +424,7 @@ test('dispatch auto-refuels: a low tank tops up to 150% of the leg requirement a
|
||||
|
||||
const landed = await getState(page);
|
||||
expect(landed.planes.find((p) => p.id === 'plane-starter')!.fuel).toBeCloseTo(
|
||||
fuelAtWeighted(target, entry.burnPerKm * windBurnFactor(wHub.windKt, wHub.windDirDeg, initialBearingDeg(nearest.hubLat, nearest.hubLon, nearest.lat, nearest.lon)) * conditionBurnMultiplier(starter.health), entry.emptyWeightKg, entry.maxFuel, km, 1),
|
||||
fuelAtWeighted(target, entry.burnPerKm * windBurnFactor(wHub.windKt, wHub.windDirDeg, initialBearingDeg(nearest.hubLat, nearest.hubLon, nearest.lat, nearest.lon)), entry.emptyWeightKg, entry.maxFuel, km, 1),
|
||||
6,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user