@dreadwood-types/types 0.1.168 → 0.1.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +8 -4
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts +20 -2
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js.map +1 -1
- package/dist/westernEntrance.d.ts +1 -1
- package/dist/westernEntrance.d.ts.map +1 -1
- package/dist/westernEntrance.js +2 -2
- package/dist/westernEntrance.js.map +1 -1
- package/dist/westernTrain.d.ts +202 -0
- package/dist/westernTrain.d.ts.map +1 -0
- package/dist/westernTrain.js +331 -0
- package/dist/westernTrain.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The moving train (James, 2026-10-10: "the train will circuit ... pull up from the ocean, come to where it is currently,
|
|
3
|
+
* then go into the cave automatically on a constant run time"; and THE ROUTE: board at the platform, into the tunnel
|
|
4
|
+
* under the water, mostly dark with cave torches, stops at the island to the west, an underground dwarf dungeon and the
|
|
5
|
+
* Capital, then all the way round, 1-3 trains running constantly). Plan `.cursor/task-plans/2026-10-10-moving-train.md`;
|
|
6
|
+
* the moving-floor idea is `2026-10-09-start-train.md` (the Deeprun Tram).
|
|
7
|
+
*
|
|
8
|
+
* THE MOVING FLOOR. The rake at the platform (westernEntrance.ts: loco, tender, four cars, cargo car, guard van) is the
|
|
9
|
+
* train's DOCKED FRAME: its deck tiles are laid in the world once, and a rider's tile is always kept in that frame (a
|
|
10
|
+
* cart-local tile). While the train is docked the frame is the world: people walk on and off by the step plates. When it
|
|
11
|
+
* leaves, everyone on the rake becomes a rider; their world tile is the docked tile carried along the circuit by the
|
|
12
|
+
* train's position, so every rider moves with the cart in the same server step, walks the deck with the normal pathing
|
|
13
|
+
* (in the docked frame) and never needs a prediction. The client draws the rake and its riders from the same clock.
|
|
14
|
+
*
|
|
15
|
+
* THE CIRCUIT is one track coordinate `c` (tiles), in the order the train runs it:
|
|
16
|
+
* - the SURFACE leg: c 0 at the sea end of the line (x 199) west along z 1153 to the tunnel mouth (c 173 is x 26);
|
|
17
|
+
* - the TUNNEL leg: c 174 on in a straight tunnel cut in the underground strip (dark, lit by wall sconces), heading south;
|
|
18
|
+
* - at c = WESTERN_TRAIN_CIRCUIT_LENGTH it wraps to 0: the train comes up out of the sea at the causeway again.
|
|
19
|
+
* The nose leads; a piece `u` tiles behind the nose (its docked x minus the nose's docked x) is at c - u.
|
|
20
|
+
*
|
|
21
|
+
* THE TIMETABLE is a pure function of the server's clock (WESTERN_TRAIN_EPOCH_MS), so it survives restarts and every
|
|
22
|
+
* client draws the same train from the clock sent with the chunks (`trainClock`). The trains run the same timetable
|
|
23
|
+
* WESTERN_TRAIN_COUNT apart. Stops other than the platform are data (WESTERN_TRAIN_STOPS, `enabled: false`) until their
|
|
24
|
+
* places are built; switching one on adds its dwell to the cycle.
|
|
25
|
+
*/
|
|
26
|
+
import { CAPITAL_BUILDING_MODELS, HEIGHT_STEP, UNDERGROUND_END_X } from './constants.js';
|
|
27
|
+
import { WESTERN_CARS, WESTERN_GANGWAYS, WESTERN_JOINTS, WESTERN_KIT_DECK_METRES, WESTERN_PRECINCT_HEIGHT, WESTERN_RAKE_SLOTS, WESTERN_SEA_END, WESTERN_STEPS, WESTERN_TRACK, WESTERN_TRACK_Z, westernCausewayHeight, } from './westernEntrance.js';
|
|
28
|
+
/* ------------------------------------------------------------------ *
|
|
29
|
+
* The docked rake (the cart-local frame).
|
|
30
|
+
* ------------------------------------------------------------------ */
|
|
31
|
+
/** The loco's nose when docked (the platform's west end), the docked frame's origin along the line. */
|
|
32
|
+
export const WESTERN_TRAIN_NOSE_X = WESTERN_RAKE_SLOTS[0].minX;
|
|
33
|
+
/** The last tile of the rake when docked: the tail chain behind the guard van's veranda. */
|
|
34
|
+
export const WESTERN_TRAIN_TAIL_X = WESTERN_RAKE_SLOTS[WESTERN_RAKE_SLOTS.length - 1].maxX + 1;
|
|
35
|
+
/** Tiles from the nose to the tail chain, inclusive (73). */
|
|
36
|
+
export const WESTERN_TRAIN_RAKE_LENGTH = WESTERN_TRAIN_TAIL_X - WESTERN_TRAIN_NOSE_X + 1;
|
|
37
|
+
/** Half the rake's width: every piece is 5 across, centred on the track row. */
|
|
38
|
+
export const WESTERN_TRAIN_HALF_ACROSS = 2;
|
|
39
|
+
/** The docked tiles a rider can stand on: the rake's deck from the nose to the guard van, the track row +-2. */
|
|
40
|
+
export const WESTERN_TRAIN_RIDE_BOX = {
|
|
41
|
+
minX: WESTERN_TRAIN_NOSE_X,
|
|
42
|
+
maxX: WESTERN_RAKE_SLOTS[WESTERN_RAKE_SLOTS.length - 1].maxX,
|
|
43
|
+
minZ: WESTERN_TRACK_Z - WESTERN_TRAIN_HALF_ACROSS,
|
|
44
|
+
maxZ: WESTERN_TRACK_Z + WESTERN_TRAIN_HALF_ACROSS,
|
|
45
|
+
};
|
|
46
|
+
export function inWesternTrainRideBox(x, z) {
|
|
47
|
+
const b = WESTERN_TRAIN_RIDE_BOX;
|
|
48
|
+
return x >= b.minX && x <= b.maxX && z >= b.minZ && z <= b.maxZ;
|
|
49
|
+
}
|
|
50
|
+
export const WESTERN_RAKE_PIECES = (() => {
|
|
51
|
+
const placed = WESTERN_RAKE_SLOTS.filter((s) => s.model in CAPITAL_BUILDING_MODELS);
|
|
52
|
+
const out = [];
|
|
53
|
+
const gangway = (id, x) => {
|
|
54
|
+
out.push({ id, style: 'westgangway-e', x, z: WESTERN_TRACK_Z });
|
|
55
|
+
out.push({ id: `${id}-rail-n`, style: 'landingrail-s', x, z: WESTERN_TRACK_Z - 1 });
|
|
56
|
+
out.push({ id: `${id}-rail-s`, style: 'landingrail-s', x, z: WESTERN_TRACK_Z + 1 });
|
|
57
|
+
};
|
|
58
|
+
for (const s of placed)
|
|
59
|
+
out.push({ id: `western-${s.id}`, style: `${s.model}-${s.facing}`, x: s.anchor[0], z: s.anchor[1] });
|
|
60
|
+
for (const c of WESTERN_CARS)
|
|
61
|
+
out.push({ id: `western-${c.id}`, style: 'westcarriage-e', x: c.anchor[0], z: c.anchor[1] });
|
|
62
|
+
WESTERN_GANGWAYS.forEach(([x], i) => gangway(`western-gangway-${i + 1}`, x));
|
|
63
|
+
for (const j of WESTERN_JOINTS)
|
|
64
|
+
if (placed.some((s) => s.id === j.slot))
|
|
65
|
+
gangway(`western-joint-${j.slot}`, j.x);
|
|
66
|
+
if (placed.some((s) => s.id === WESTERN_RAKE_SLOTS[WESTERN_RAKE_SLOTS.length - 1].id)) {
|
|
67
|
+
out.push({ id: 'western-tail-chain', style: 'landingrail-e', x: WESTERN_TRAIN_TAIL_X, z: WESTERN_TRACK_Z });
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
})();
|
|
71
|
+
const RAKE_PIECE_IDS = new Set(WESTERN_RAKE_PIECES.map((p) => p.id));
|
|
72
|
+
/** Is this entity one of the docked rake's models (hidden while no train is at the platform)? */
|
|
73
|
+
export function isWesternRakePieceId(id) {
|
|
74
|
+
return typeof id === 'string' && RAKE_PIECE_IDS.has(id);
|
|
75
|
+
}
|
|
76
|
+
/* ------------------------------------------------------------------ *
|
|
77
|
+
* The circuit.
|
|
78
|
+
* ------------------------------------------------------------------ */
|
|
79
|
+
/**
|
|
80
|
+
* The tunnel under the water: a straight bore in the underground strip (x >= UNDERGROUND_ORIGIN_X), rows 800 on of
|
|
81
|
+
* which held nothing on 2026-10-10 (scanned: no walkable tile, no entity). Seven tiles wide (the rake's five and a
|
|
82
|
+
* sconce row each side), its floor at the platform's ground height so the cars ride at the same height, the strip's
|
|
83
|
+
* own rock round it. Heading south: c 174 is its north end.
|
|
84
|
+
*/
|
|
85
|
+
export const WESTERN_TUNNEL_X = UNDERGROUND_END_X - 18;
|
|
86
|
+
export const WESTERN_TUNNEL_START_Z = 806;
|
|
87
|
+
export const WESTERN_TUNNEL_LENGTH = 556;
|
|
88
|
+
export const WESTERN_TUNNEL_HALF_WIDTH = 3;
|
|
89
|
+
export const WESTERN_TUNNEL_FLOOR_HEIGHT = WESTERN_PRECINCT_HEIGHT;
|
|
90
|
+
/** The bore, walls excluded (the floor tiles). The rock caps at either end hide the train going in and out. */
|
|
91
|
+
export const WESTERN_TUNNEL_BOX = {
|
|
92
|
+
minX: WESTERN_TUNNEL_X - WESTERN_TUNNEL_HALF_WIDTH,
|
|
93
|
+
maxX: WESTERN_TUNNEL_X + WESTERN_TUNNEL_HALF_WIDTH,
|
|
94
|
+
minZ: WESTERN_TUNNEL_START_Z,
|
|
95
|
+
maxZ: WESTERN_TUNNEL_START_Z + WESTERN_TUNNEL_LENGTH - 1,
|
|
96
|
+
};
|
|
97
|
+
export function inWesternTunnel(x, z) {
|
|
98
|
+
const b = WESTERN_TUNNEL_BOX;
|
|
99
|
+
return x >= b.minX - 1 && x <= b.maxX + 1 && z >= b.minZ - 1 && z <= b.maxZ + 1;
|
|
100
|
+
}
|
|
101
|
+
/** Wall sconces (westsconce, a lantern on a riveted plate) every this many tiles down each side, staggered. */
|
|
102
|
+
export const WESTERN_TUNNEL_SCONCE_EVERY = 14;
|
|
103
|
+
/** The /tp into the tunnel (admins): its north end, beside the line. */
|
|
104
|
+
export const WESTERN_TUNNEL_STAND = { x: WESTERN_TUNNEL_X - WESTERN_TUNNEL_HALF_WIDTH, z: WESTERN_TUNNEL_START_Z + 6 };
|
|
105
|
+
const SURFACE_LENGTH = WESTERN_SEA_END.x - (WESTERN_TRACK.minX - 1) + 1; // x 199 to x 26 (the mouth tile): 174
|
|
106
|
+
export const WESTERN_TRAIN_SEGMENTS = [
|
|
107
|
+
{ id: 'surface', c0: 0, length: SURFACE_LENGTH, x0: WESTERN_SEA_END.x, z0: WESTERN_TRACK_Z, dx: -1, dz: 0 },
|
|
108
|
+
{ id: 'tunnel', c0: SURFACE_LENGTH, length: WESTERN_TUNNEL_LENGTH, x0: WESTERN_TUNNEL_X, z0: WESTERN_TUNNEL_START_Z, dx: 0, dz: 1 },
|
|
109
|
+
];
|
|
110
|
+
export const WESTERN_TRAIN_CIRCUIT_LENGTH = WESTERN_TRAIN_SEGMENTS.reduce((n, s) => n + s.length, 0);
|
|
111
|
+
/** c of the nose when the train stands at the platform (loco's nose at x 30). */
|
|
112
|
+
export const WESTERN_TRAIN_PLATFORM_C = WESTERN_SEA_END.x - WESTERN_TRAIN_NOSE_X;
|
|
113
|
+
/** The lateral unit: the docked frame's +z (the sea side) for a leg heading (dx, dz). */
|
|
114
|
+
function lateralOf(seg) {
|
|
115
|
+
return { lx: seg.dz, lz: -seg.dx };
|
|
116
|
+
}
|
|
117
|
+
/** The yaw (radians, three.js about +y) that turns the docked frame (heading -x) to this leg's heading. */
|
|
118
|
+
export function westernTrainSegmentYaw(seg) {
|
|
119
|
+
// A model facing +z yawed by t faces (sin t, cos t); the docked heading (-1, 0) is t = -pi/2.
|
|
120
|
+
return Math.atan2(seg.dx, seg.dz) + Math.PI / 2;
|
|
121
|
+
}
|
|
122
|
+
export function wrapWesternC(c) {
|
|
123
|
+
const n = WESTERN_TRAIN_CIRCUIT_LENGTH;
|
|
124
|
+
return ((c % n) + n) % n;
|
|
125
|
+
}
|
|
126
|
+
export function westernTrainSegmentAt(c) {
|
|
127
|
+
const w = wrapWesternC(c);
|
|
128
|
+
for (const seg of WESTERN_TRAIN_SEGMENTS)
|
|
129
|
+
if (w >= seg.c0 && w < seg.c0 + seg.length)
|
|
130
|
+
return seg;
|
|
131
|
+
return WESTERN_TRAIN_SEGMENTS[0];
|
|
132
|
+
}
|
|
133
|
+
/** A point on a leg (c may run past its ends: the client extrapolates a piece into the sea or the rock). */
|
|
134
|
+
export function westernTrainPointOn(seg, c, lateral) {
|
|
135
|
+
const { lx, lz } = lateralOf(seg);
|
|
136
|
+
const along = c - seg.c0;
|
|
137
|
+
return { x: seg.x0 + seg.dx * along + lx * lateral, z: seg.z0 + seg.dz * along + lz * lateral };
|
|
138
|
+
}
|
|
139
|
+
/** The world point of track coordinate c (wrapped) and a lateral offset (docked z - track z). */
|
|
140
|
+
export function westernTrainWorldPoint(c, lateral) {
|
|
141
|
+
const segment = westernTrainSegmentAt(c);
|
|
142
|
+
return { ...westernTrainPointOn(segment, wrapWesternC(c), lateral), segment };
|
|
143
|
+
}
|
|
144
|
+
/** The ground under the track at c on a leg (terrain steps; the causeway steps down to the waterline, then the sea). */
|
|
145
|
+
export function westernTrainGroundHeight(seg, c) {
|
|
146
|
+
if (seg.id === 'tunnel')
|
|
147
|
+
return WESTERN_TUNNEL_FLOOR_HEIGHT;
|
|
148
|
+
const x = seg.x0 + seg.dx * (c - seg.c0);
|
|
149
|
+
if (x > WESTERN_SEA_END.x)
|
|
150
|
+
return -(x - WESTERN_SEA_END.x) * 1.4; // under the sea past the line's end
|
|
151
|
+
const lo = Math.floor(x), t = x - lo;
|
|
152
|
+
const h = (xi) => (xi >= 178 ? westernCausewayHeight(Math.min(xi, WESTERN_SEA_END.x)) : WESTERN_PRECINCT_HEIGHT);
|
|
153
|
+
return h(lo) * (1 - t) + h(lo + 1) * t;
|
|
154
|
+
}
|
|
155
|
+
/** Metres: the deck a rider stands on at c (the ground plus the kit's deck height). */
|
|
156
|
+
export function westernTrainDeckY(seg, c) {
|
|
157
|
+
return westernTrainGroundHeight(seg, c) * HEIGHT_STEP + WESTERN_KIT_DECK_METRES;
|
|
158
|
+
}
|
|
159
|
+
/** A docked tile (rider or piece) to its c, given the nose's c. */
|
|
160
|
+
export function westernDockedC(noseC, dockedX) {
|
|
161
|
+
return noseC - (dockedX - WESTERN_TRAIN_NOSE_X);
|
|
162
|
+
}
|
|
163
|
+
/** The world tile of a docked tile when the nose stands at integer c (the server's step). */
|
|
164
|
+
export function westernRiderWorldTile(noseC, dockedX, dockedZ) {
|
|
165
|
+
const p = westernTrainWorldPoint(westernDockedC(noseC, dockedX), dockedZ - WESTERN_TRACK_Z);
|
|
166
|
+
return { x: Math.round(p.x), y: Math.round(p.z) };
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* A world tile back to the docked frame of a train whose nose is at c (a rider's click on the moving deck), or null when
|
|
170
|
+
* the tile is not on the rake.
|
|
171
|
+
*/
|
|
172
|
+
export function westernWorldToDocked(noseC, x, z) {
|
|
173
|
+
for (const seg of WESTERN_TRAIN_SEGMENTS) {
|
|
174
|
+
const { lx, lz } = lateralOf(seg);
|
|
175
|
+
const along = (x - seg.x0) * seg.dx + (z - seg.z0) * seg.dz;
|
|
176
|
+
const lateral = (x - seg.x0) * lx + (z - seg.z0) * lz;
|
|
177
|
+
if (along < 0 || along >= seg.length || Math.abs(lateral) > WESTERN_TRAIN_HALF_ACROSS)
|
|
178
|
+
continue;
|
|
179
|
+
const behind = wrapWesternC(noseC - (seg.c0 + along));
|
|
180
|
+
if (behind > WESTERN_TRAIN_RAKE_LENGTH - 1)
|
|
181
|
+
continue;
|
|
182
|
+
return { x: WESTERN_TRAIN_NOSE_X + behind, y: WESTERN_TRACK_Z + lateral };
|
|
183
|
+
}
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
/* ------------------------------------------------------------------ *
|
|
187
|
+
* The timetable.
|
|
188
|
+
* ------------------------------------------------------------------ */
|
|
189
|
+
/** Every train counts from this instant (a fixed date, so a restart never moves a train). */
|
|
190
|
+
export const WESTERN_TRAIN_EPOCH_MS = Date.UTC(2026, 9, 10, 0, 0, 0);
|
|
191
|
+
/** How many trains run the circuit, evenly spaced in time (James: "1-3 trains running constantly"). */
|
|
192
|
+
export const WESTERN_TRAIN_COUNT = 2;
|
|
193
|
+
/** Cruising speed (tiles a second) and the rate it gets up to it and slows from it. */
|
|
194
|
+
export const WESTERN_TRAIN_TOP_SPEED = 6;
|
|
195
|
+
export const WESTERN_TRAIN_ACCEL = 0.5;
|
|
196
|
+
/** The bell rings this long before a departure; the step plates shut this long before it. */
|
|
197
|
+
export const WESTERN_TRAIN_BELL_BEFORE_MS = 15_000;
|
|
198
|
+
export const WESTERN_TRAIN_DOORS_SHUT_BEFORE_MS = 5_000;
|
|
199
|
+
/** The whistle and the bell are heard this far (tiles) from the loco. */
|
|
200
|
+
export const WESTERN_TRAIN_SOUND_RANGE = 40;
|
|
201
|
+
export const WESTERN_TRAIN_MOVING_TEXT = 'The train is moving.';
|
|
202
|
+
export const WESTERN_TRAIN_DOORS_SHUT_TEXT = 'The doors are shut: the train is about to leave.';
|
|
203
|
+
export const WESTERN_TRAIN_ABOARD_COMBAT_TEXT = 'There is no fighting aboard the train.';
|
|
204
|
+
export const WESTERN_TRAIN_ALIGHT_MOVING_TEXT = 'The train is moving. Wait until it stops at the platform.';
|
|
205
|
+
export const WESTERN_TRAIN_STOPS = [
|
|
206
|
+
{ id: 'platform', name: 'The Western Entrance', c: WESTERN_TRAIN_PLATFORM_C, dwellMs: 60_000, enabled: true, note: 'The platform on the headland: boarding by the step plates.' },
|
|
207
|
+
{ id: 'western-isle', name: 'The Western Isle', c: SURFACE_LENGTH + 150, dwellMs: 45_000, enabled: false, note: 'The island to the west is not built yet: a halt, a platform and a way up to the island are needed.' },
|
|
208
|
+
{ id: 'dwarf-hold', name: 'The Dwarf Hold', c: SURFACE_LENGTH + 300, dwellMs: 45_000, enabled: false, note: 'An underground dwarf dungeon beside the bore; its exit is blocked for now.' },
|
|
209
|
+
{ id: 'capital', name: 'The Capital', c: SURFACE_LENGTH + 450, dwellMs: 60_000, enabled: false, note: 'Not reachable by a surface line (the city is ~900 rows north); needs an underground halt on this bore and a stair or lift from the city.' },
|
|
210
|
+
];
|
|
211
|
+
/** Duration (ms) of a run of D tiles from a stop to a stop: up to speed, cruise, slow to a stand. */
|
|
212
|
+
export function westernTrainRunMs(distance) {
|
|
213
|
+
const v = WESTERN_TRAIN_TOP_SPEED, a = WESTERN_TRAIN_ACCEL;
|
|
214
|
+
const ramp = (v * v) / a; // tiles spent getting up to speed and slowing again
|
|
215
|
+
const s = distance >= ramp ? distance / v + v / a : 2 * Math.sqrt(distance / a);
|
|
216
|
+
return s * 1000;
|
|
217
|
+
}
|
|
218
|
+
/** Tiles covered after t ms of a run of D tiles. */
|
|
219
|
+
export function westernTrainRunTiles(distance, tMs) {
|
|
220
|
+
const v = WESTERN_TRAIN_TOP_SPEED, a = WESTERN_TRAIN_ACCEL;
|
|
221
|
+
const total = westernTrainRunMs(distance) / 1000;
|
|
222
|
+
const t = Math.max(0, Math.min(total, tMs / 1000));
|
|
223
|
+
const peak = Math.min(v, Math.sqrt(distance * a));
|
|
224
|
+
const ta = peak / a;
|
|
225
|
+
if (t <= ta)
|
|
226
|
+
return 0.5 * a * t * t;
|
|
227
|
+
if (t >= total - ta)
|
|
228
|
+
return distance - 0.5 * a * (total - t) ** 2;
|
|
229
|
+
return 0.5 * a * ta * ta + peak * (t - ta);
|
|
230
|
+
}
|
|
231
|
+
/** The cycle: for each running stop in order, its dwell then the run to the next running stop (wrapping). */
|
|
232
|
+
export function westernTrainTimetable(stops = WESTERN_TRAIN_STOPS) {
|
|
233
|
+
const running = stops.filter((s) => s.enabled).sort((a, b) => a.c - b.c);
|
|
234
|
+
const legs = [];
|
|
235
|
+
let t = 0;
|
|
236
|
+
running.forEach((stop, i) => {
|
|
237
|
+
const next = running[(i + 1) % running.length];
|
|
238
|
+
const runTiles = wrapWesternC(next.c - stop.c) || WESTERN_TRAIN_CIRCUIT_LENGTH;
|
|
239
|
+
const startMs = t;
|
|
240
|
+
const departMs = startMs + stop.dwellMs;
|
|
241
|
+
const endMs = departMs + westernTrainRunMs(runTiles);
|
|
242
|
+
legs.push({ stop, startMs, departMs, runTiles, endMs });
|
|
243
|
+
t = endMs;
|
|
244
|
+
});
|
|
245
|
+
return { cycleMs: t, legs };
|
|
246
|
+
}
|
|
247
|
+
const TIMETABLE = westernTrainTimetable();
|
|
248
|
+
export const WESTERN_TRAIN_CYCLE_MS = TIMETABLE.cycleMs;
|
|
249
|
+
/** Is any piece of the rake on the surface leg with the nose at c? */
|
|
250
|
+
function rakeOnSurface(noseC) {
|
|
251
|
+
const surface = WESTERN_TRAIN_SEGMENTS[0];
|
|
252
|
+
const tail = noseC - (WESTERN_TRAIN_RAKE_LENGTH - 1);
|
|
253
|
+
return noseC >= surface.c0 && tail < surface.c0 + surface.length;
|
|
254
|
+
}
|
|
255
|
+
/** Where train `train` (0-based) is at server time `nowMs`. */
|
|
256
|
+
export function westernTrainAt(nowMs, train = 0, timetable = TIMETABLE) {
|
|
257
|
+
const cycle = timetable.cycleMs;
|
|
258
|
+
const offset = (train * cycle) / WESTERN_TRAIN_COUNT;
|
|
259
|
+
const t = (((nowMs - WESTERN_TRAIN_EPOCH_MS + offset) % cycle) + cycle) % cycle;
|
|
260
|
+
const platform = timetable.legs.find((l) => l.stop.id === 'platform');
|
|
261
|
+
const msToPlatform = platform ? ((platform.startMs - t) % cycle + cycle) % cycle : 0;
|
|
262
|
+
for (const leg of timetable.legs) {
|
|
263
|
+
if (t < leg.startMs || t >= leg.endMs)
|
|
264
|
+
continue;
|
|
265
|
+
if (t < leg.departMs) {
|
|
266
|
+
const noseC = wrapWesternC(leg.stop.c);
|
|
267
|
+
return {
|
|
268
|
+
train, noseC, noseStep: Math.floor(noseC), moving: false,
|
|
269
|
+
phase: leg.stop.id === 'platform' ? 'boarding' : 'away',
|
|
270
|
+
stopId: leg.stop.id, msToDepart: leg.departMs - t,
|
|
271
|
+
msToPlatform: leg.stop.id === 'platform' ? 0 : msToPlatform, cycleMs: t,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
const noseC = wrapWesternC(leg.stop.c + westernTrainRunTiles(leg.runTiles, t - leg.departMs));
|
|
275
|
+
const onSurface = rakeOnSurface(noseC);
|
|
276
|
+
const phase = !onSurface ? 'away' : noseC < WESTERN_TRAIN_PLATFORM_C ? 'approaching' : 'departing';
|
|
277
|
+
return { train, noseC, noseStep: Math.floor(noseC), moving: true, phase, stopId: null, msToDepart: null, msToPlatform, cycleMs: t };
|
|
278
|
+
}
|
|
279
|
+
// Rounding at the cycle's very end: treat as the first leg's start.
|
|
280
|
+
const first = timetable.legs[0];
|
|
281
|
+
return {
|
|
282
|
+
train, noseC: wrapWesternC(first.stop.c), noseStep: Math.floor(wrapWesternC(first.stop.c)), moving: false,
|
|
283
|
+
phase: first.stop.id === 'platform' ? 'boarding' : 'away', stopId: first.stop.id, msToDepart: first.stop.dwellMs,
|
|
284
|
+
msToPlatform: 0, cycleMs: 0,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/** The train standing at the platform at `nowMs`, or null. */
|
|
288
|
+
export function westernTrainAtPlatform(nowMs) {
|
|
289
|
+
for (let i = 0; i < WESTERN_TRAIN_COUNT; i++) {
|
|
290
|
+
const s = westernTrainAt(nowMs, i);
|
|
291
|
+
if (s.phase === 'boarding')
|
|
292
|
+
return s;
|
|
293
|
+
}
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
/** Ms until the next train stands at the platform (0 if one is there). */
|
|
297
|
+
export function westernTrainNextArrivalMs(nowMs) {
|
|
298
|
+
let best = Infinity;
|
|
299
|
+
for (let i = 0; i < WESTERN_TRAIN_COUNT; i++)
|
|
300
|
+
best = Math.min(best, westernTrainAt(nowMs, i).msToPlatform);
|
|
301
|
+
return best;
|
|
302
|
+
}
|
|
303
|
+
/** The refusal text for the step plates while no train can be boarded. */
|
|
304
|
+
export function westernTrainNoBoardingText(nowMs) {
|
|
305
|
+
const here = westernTrainAtPlatform(nowMs);
|
|
306
|
+
if (here)
|
|
307
|
+
return WESTERN_TRAIN_DOORS_SHUT_TEXT;
|
|
308
|
+
for (let i = 0; i < WESTERN_TRAIN_COUNT; i++) {
|
|
309
|
+
const s = westernTrainAt(nowMs, i);
|
|
310
|
+
if (s.phase === 'approaching' || s.phase === 'departing')
|
|
311
|
+
return WESTERN_TRAIN_MOVING_TEXT;
|
|
312
|
+
}
|
|
313
|
+
const secs = Math.max(1, Math.round(westernTrainNextArrivalMs(nowMs) / 1000));
|
|
314
|
+
return `No train stands at the platform. The next one is due in about ${secs} seconds.`;
|
|
315
|
+
}
|
|
316
|
+
/** Can the step plates be used at `nowMs` (a train standing, more than the shut time to go)? */
|
|
317
|
+
export function westernTrainDoorsOpen(nowMs) {
|
|
318
|
+
const here = westernTrainAtPlatform(nowMs);
|
|
319
|
+
return !!here && (here.msToDepart ?? 0) > WESTERN_TRAIN_DOORS_SHUT_BEFORE_MS;
|
|
320
|
+
}
|
|
321
|
+
/** The surface leg's x range the rake is drawn on (the mouth hides it to the west, the sea to the east). */
|
|
322
|
+
export const WESTERN_TRAIN_SURFACE_DRAW = { minX: 18, maxX: WESTERN_SEA_END.x + 8 };
|
|
323
|
+
/** The platform tile in front of the nearest step plate to a docked x (where someone left on the docked rake is put). */
|
|
324
|
+
export function westernPlatformTileNear(x) {
|
|
325
|
+
let best = WESTERN_STEPS[0];
|
|
326
|
+
for (const s of WESTERN_STEPS)
|
|
327
|
+
if (Math.abs(s.x - x) < Math.abs(best.x - x))
|
|
328
|
+
best = s;
|
|
329
|
+
return { x: best.platform[0], y: best.platform[1] };
|
|
330
|
+
}
|
|
331
|
+
//# sourceMappingURL=westernTrain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"westernTrain.js","sourceRoot":"","sources":["../src/westernTrain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,aAAa,EACb,eAAe,EACf,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAI9B;;wEAEwE;AAExE,uGAAuG;AACvG,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC;AA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AAI,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,kCAAkC,CAAC;AAC/E,CAAC;AAED,4GAA4G;AAC5G,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,GAAG,CAAC,EAAW,CAAC;AAC7F,yHAAyH;AACzH,MAAM,UAAU,uBAAuB,CAAC,CAAS;IAC/C,IAAI,IAAI,GAAG,aAAa,CAAC,CAAC,CAAE,CAAC;IAC7B,KAAK,MAAM,CAAC,IAAI,aAAa;QAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAAE,IAAI,GAAG,CAAC,CAAC;IACtF,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AACtD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreadwood-types/types",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.170",
|
|
4
4
|
"description": "Public wire protocol and client-safe constants for Dreadwoods",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsc -p tsconfig.json",
|
|
25
|
-
"test": "node --test scripts/animation-test.mjs scripts/starter-jobs-test.mjs scripts/cooking-nudge-test.mjs scripts/surface-chart-test.mjs scripts/south-expansion-test.mjs scripts/rudd-test.mjs scripts/cave-map-test.mjs scripts/birch-combat-test.mjs scripts/fort-rook-bosses-test.mjs scripts/bounty-first-test.mjs scripts/running-test.mjs scripts/energy-test.mjs scripts/starter-town-test.mjs scripts/starter-expansion-test.mjs scripts/five-arches-test.mjs scripts/landing-test.mjs scripts/cove-ship-test.mjs scripts/south-fields-quests-test.mjs scripts/arcane-lands-test.mjs scripts/fair-folk-test.mjs scripts/world-boss-ring-test.mjs scripts/ringstone-fight-test.mjs scripts/hopewood-wildlife-test.mjs scripts/hopewood-quests-test.mjs scripts/western-train-test.mjs",
|
|
25
|
+
"test": "node --test scripts/animation-test.mjs scripts/starter-jobs-test.mjs scripts/cooking-nudge-test.mjs scripts/surface-chart-test.mjs scripts/south-expansion-test.mjs scripts/rudd-test.mjs scripts/cave-map-test.mjs scripts/birch-combat-test.mjs scripts/fort-rook-bosses-test.mjs scripts/bounty-first-test.mjs scripts/running-test.mjs scripts/energy-test.mjs scripts/starter-town-test.mjs scripts/starter-expansion-test.mjs scripts/five-arches-test.mjs scripts/landing-test.mjs scripts/cove-ship-test.mjs scripts/south-fields-quests-test.mjs scripts/arcane-lands-test.mjs scripts/fair-folk-test.mjs scripts/world-boss-ring-test.mjs scripts/ringstone-fight-test.mjs scripts/hopewood-wildlife-test.mjs scripts/hopewood-quests-test.mjs scripts/western-train-test.mjs scripts/moving-train-test.mjs",
|
|
26
26
|
"dev": "tsc -p tsconfig.json --watch",
|
|
27
27
|
"prepare": "npm run build",
|
|
28
28
|
"prepublishOnly": "npm run build"
|