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

19 lines
684 B
TypeScript

import type { GameConfig, ShipModel } from "@deadhead/content";
/**
* Trip duration in game hours: cruise time, the ship's fixed takeoff/landing
* overhead, and loading/unloading time for the cargo (decision 0.5.31). Pass
* the distance at departure; it is not recalculated mid-flight. Repositions
* carry zero mass.
*/
export function travelTimeGameHours(
ship: ShipModel,
distanceMillionKm: number,
massTonnes: number,
config: GameConfig,
): number {
const cruiseHours = (distanceMillionKm * 1e6) / ship.cruiseSpeedKmPerGameHour;
const handlingHours = massTonnes * config.handlingGameHoursPerTonne;
return cruiseHours + ship.overheadGameHours + handlingHours;
}