mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
Live trains from 30 keyless operator feeds: GPS positions from 29 and Irish Rail's station reports, shown as the operators publish them. 28 work out of the box; Renfe long and medium distance and KTMB appear once their pack is built, because their vehicles name no route. Packs are opt-in (scripts/build-rail-paths.mjs): the operator's own route lines, stop names, next stops and trip-update delays for live trains. Nothing downloads when the app starts, no train is placed from a timetable, and no request carries a deployer's key.
51 lines
1.8 KiB
JavaScript
51 lines
1.8 KiB
JavaScript
import { createRailLayer } from '../../layers/rail/index.js';
|
|
import * as render from '../../renderGovernor.js';
|
|
import * as sprites from '../../data/spriteOrder.js';
|
|
import * as picking from '../../data/pickRegistry.js';
|
|
import * as overlays from '../../overlays/worldOverlay.js';
|
|
import { applyTrackedCameraFrame } from '../../data/trackedCamera.js';
|
|
import { WORLD_FOCUS_FRAMING, requestWorldFocus } from '../../worldFocus.js';
|
|
import {
|
|
railFeedCredit,
|
|
registerDynamicCredit,
|
|
} from '../../data/dataCredits.js';
|
|
|
|
/**
|
|
* Construct the Rail layer on the application's scene owners and its shared
|
|
* ground floor, the same floor Transit and the aircraft stand on.
|
|
* @param {{surface: object, source?: object}} options
|
|
* @returns {object}
|
|
*/
|
|
export function createApplicationRail({ surface, source }) {
|
|
if (!surface?.groundFloor)
|
|
throw new TypeError('Rail needs the application surface services');
|
|
const { groundFloor } = surface;
|
|
return createRailLayer({
|
|
source,
|
|
services: {
|
|
render,
|
|
sprites,
|
|
picking,
|
|
overlays,
|
|
credits: { registerDynamicCredit, railFeedCredit },
|
|
ground: {
|
|
GROUND_FLOOR_LIFT_M: groundFloor.GROUND_FLOOR_LIFT_M,
|
|
cachedGroundFloor: groundFloor.cachedGroundFloor,
|
|
warmGroundFloor: groundFloor.warmGroundFloor,
|
|
neighborFloorM: groundFloor.neighborFloorM,
|
|
coarseFloorCoord: groundFloor.coarseFloorCoord,
|
|
},
|
|
// A selected train is followed as a tracked aircraft is, or flown to
|
|
// once as a vessel is (src/layers/rail/follow.js).
|
|
camera: {
|
|
framing: WORLD_FOCUS_FRAMING.train,
|
|
requestWorldFocus,
|
|
applyTrackedCameraFrame,
|
|
isCockpitActive: () =>
|
|
globalThis.document?.body?.classList?.contains('cockpit-mode') ===
|
|
true,
|
|
},
|
|
},
|
|
});
|
|
}
|