feat: let rockets plunge into the black hole core

Inside the shadow a rocket's velocity now turns toward the centre, so it falls to the
singularity instead of swinging round it, and the trail of a rocket that reaches the
core lingers and fades briefly.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 15:56:08 +07:00
parent 45497c0993
commit 88d3fa665b
3 changed files with 59 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
import assert from "node:assert/strict";
import test from "node:test";
import {
MAX_ROCKETS, SHADOW_EDGE, adoptCircle, applyActivity, createField, fieldActive, holding, infallLook, screenRadius,
ABSORB_LINGER, MAX_ROCKETS, SHADOW_EDGE, adoptCircle, applyActivity, createField, fieldActive, holding, infallLook, screenRadius,
starPose, stepField,
} from "../src/lib/rocket.ts";
@@ -48,7 +48,7 @@ function fly(s, limit = 12) {
return { arrived, wait, flight, sweep: (Math.abs(swept) * 180) / Math.PI };
}
test("every launch, from every shell and phase of the circle, spirals in and reaches the shadow", () => {
test("every launch, from every shell and phase of the circle, spirals in and falls through the shadow to the centre", () => {
const sweeps = [];
for (const [radius, speed] of SHELLS) {
for (const rate of [0, 1]) {
@@ -65,6 +65,11 @@ test("every launch, from every shell and phase of the circle, spirals in and rea
// The path follows the momentum of the circle round the black hole: it curves, it does not run straight in.
assert.ok(result.sweep > 50 && result.sweep < 520, `${label} swept ${result.sweep} degrees`);
sweeps.push(result.sweep);
// It ends at the singularity itself, lingers a moment so its trail can finish there, then is removed.
const sunk = s.field.rockets.get("a");
assert.equal(sunk.x, 0, `${label} did not end at the centre`);
assert.equal(sunk.y, 0, `${label} did not end at the centre`);
s.step(ABSORB_LINGER + 0.1);
assert.equal(s.field.rockets.size, 0);
}
}