docs: document committed-flight intent and player hazard odds (review)
This commit is contained in:
@@ -26,6 +26,9 @@ function fromDescriptor(loc) {
|
|||||||
|
|
||||||
// target: { planetId } to fly to a planet in the current system,
|
// target: { planetId } to fly to a planet in the current system,
|
||||||
// or { laneId } to jump through a lane touching 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) {
|
export function goTo(world, target) {
|
||||||
const p = world.player;
|
const p = world.player;
|
||||||
if (!p.alive || p.won) return false;
|
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) {
|
if (loc.kind === 'lane' && world.t >= loc.arriveT - 1e-9) {
|
||||||
const lane = world.galaxy.lanes[loc.laneId];
|
const lane = world.galaxy.lanes[loc.laneId];
|
||||||
const trip = ++p.tripCount;
|
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}`);
|
const r = rollFor(`w:${world.seed}:player`, `trip${trip}`);
|
||||||
if (r < lane.hazard * 0.04) {
|
if (r < lane.hazard * 0.04) {
|
||||||
p.alive = false;
|
p.alive = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user