deadhead-space-freight-tycoon/packages/sim/src/travel.ts

11 lines
443 B
TypeScript

import type { ShipModel } from "@deadhead/content";
/**
* Trip duration in game hours: cruise time plus the ship's fixed takeoff/landing
* overhead. Pass the distance at departure; it is not recalculated mid-flight.
*/
export function travelTimeGameHours(ship: ShipModel, distanceMillionKm: number): number {
const cruiseHours = (distanceMillionKm * 1e6) / ship.cruiseSpeedKmPerGameHour;
return cruiseHours + ship.overheadGameHours;
}