docs: document committed-flight intent and player hazard odds (review)

This commit is contained in:
2026-06-12 14:33:11 +00:00
parent 37ad2dd84d
commit 3afb5b829f
+5
View File
@@ -26,6 +26,9 @@ function fromDescriptor(loc) {
// target: { planetId } to fly to a planet in the current system,
// or { laneId } to jump through a lane touching the current system.
// A { laneId } command is a COMMITTED flight: intent is stored and the
// lane jump auto-fires on reaching the gate (cleared only in startLane).
// Movement commands are rejected while in transit, so intent cannot go stale.
export function goTo(world, target) {
const p = world.player;
if (!p.alive || p.won) return false;
@@ -95,6 +98,8 @@ export function onPlayerArrive(world) {
if (loc.kind === 'lane' && world.t >= loc.arriveT - 1e-9) {
const lane = world.galaxy.lanes[loc.laneId];
const trip = ++p.tripCount;
// Player hazard odds are deliberately kinder than NPC hazardProbs
// (4% vs 6% destroyed, 15% vs 20% cargo-lost per unit hazard).
const r = rollFor(`w:${world.seed}:player`, `trip${trip}`);
if (r < lane.hazard * 0.04) {
p.alive = false;