mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Merge origin/main: shipwrecks, news, transit fronts, signal-lost trails and uncredited photos on the renderer's ports
Upstream's layers and changes are carried onto the ports, with no Cesium outside src/render and no reach into the viewer: - Shipwrecks draw as one icon set, clicked through the input dispatcher. - News draws through draw sets, the camera port and the input dispatcher; its beacons pulse each frame through the frame port. - The scene occlusion probe moves into src/render/cesium and reaches detection through a new application hook, createOcclusionProbe; its private Cesium reads go through internals.js. - Flight and military trails, the stale and SIGNAL LOST cue, coasting and following the world clock run on the draw and frame ports. GPU icons follow the scene clock while the world clock is followed, and fade when stale. A report that holds is not planned again every tick. - Vessels are keyed by their record id. The stub boot now enables military, shipwrecks and news as well.
This commit is contained in:
commit
a755f63638
331 files changed
+40654
-1666
No files matched your search
+88
-24
@@ -72,34 +72,88 @@ export function shareTrackingRestoreNotice(result) {
|
||||
: t('Shared {subject} is unavailable', { subject });
|
||||
}
|
||||
|
||||
// The not-reporting notice, one ready-made sentence per shared entity kind
|
||||
// (SHARE_VIEW_ENTITY_KINDS) for the same reason as SHARE_RESTORE_NOTICES.
|
||||
const SHARED_FIX_NOTICES = Object.freeze({
|
||||
aircraft: Object.freeze({
|
||||
lastSeen: msg(
|
||||
"The shared flight isn't reporting now — showing where it was last seen",
|
||||
),
|
||||
at: msg(
|
||||
"The shared flight isn't reporting now — showing where it was at {time}",
|
||||
),
|
||||
}),
|
||||
military_aircraft: Object.freeze({
|
||||
lastSeen: msg(
|
||||
"The shared military flight isn't reporting now — showing where it was last seen",
|
||||
),
|
||||
at: msg(
|
||||
"The shared military flight isn't reporting now — showing where it was at {time}",
|
||||
),
|
||||
}),
|
||||
vessel: Object.freeze({
|
||||
lastSeen: msg(
|
||||
"The shared vessel isn't reporting now — showing where it was last seen",
|
||||
),
|
||||
at: msg(
|
||||
"The shared vessel isn't reporting now — showing where it was at {time}",
|
||||
),
|
||||
}),
|
||||
satellite: Object.freeze({
|
||||
lastSeen: msg(
|
||||
"The shared satellite isn't reporting now — showing where it was last seen",
|
||||
),
|
||||
at: msg(
|
||||
"The shared satellite isn't reporting now — showing where it was at {time}",
|
||||
),
|
||||
}),
|
||||
});
|
||||
|
||||
// The second line names the entity by the id the link carries.
|
||||
function sharedFixDetail(entity) {
|
||||
const id = String(entity.id);
|
||||
switch (entity.kind) {
|
||||
case 'aircraft':
|
||||
case 'military_aircraft':
|
||||
// ICAO addresses read as they are written on the aircraft: upper case.
|
||||
return t('ICAO: {id}', { id: id.toUpperCase() });
|
||||
case 'satellite':
|
||||
return t('NORAD: {id}', { id });
|
||||
case 'vessel':
|
||||
return /^\d+$/.test(id)
|
||||
? t('MMSI: {id}', { id })
|
||||
: t('Vessel UUID: {id}', { id: id.toLowerCase() });
|
||||
default:
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The notice for a shared entity that is not reporting: the view shows where
|
||||
* it was when the link was made.
|
||||
* it was when the link was made. The sentence is the notice; the entity's id
|
||||
* goes on a second line under it.
|
||||
* @param {{kind: string, id: string}} entity
|
||||
* @param {number|null} observedAtMs
|
||||
* @param {number} [nowMs]
|
||||
* @returns {string}
|
||||
* @returns {{message: string, detail: string}}
|
||||
*/
|
||||
export function sharedFixNotice(entity, observedAtMs, nowMs = Date.now()) {
|
||||
// ICAO addresses read as they are written on the aircraft: upper case.
|
||||
const id =
|
||||
ENTITY_BY_KIND.get(entity.kind)?.idForm === 'hex24'
|
||||
? String(entity.id).toUpperCase()
|
||||
: String(entity.id);
|
||||
const detail = sharedFixDetail(entity);
|
||||
const notices = SHARED_FIX_NOTICES[entity.kind];
|
||||
if (!notices)
|
||||
return {
|
||||
message: t('Shared {subject} is unavailable', { subject: t('entity') }),
|
||||
detail,
|
||||
};
|
||||
if (!Number.isFinite(observedAtMs))
|
||||
return t("{id} isn't reporting now — showing where it was last seen", {
|
||||
id,
|
||||
});
|
||||
return { message: t(notices.lastSeen), detail };
|
||||
const time = formatDate(
|
||||
observedAtMs,
|
||||
nowMs - observedAtMs < DAY_MS
|
||||
? { hour: '2-digit', minute: '2-digit' }
|
||||
: { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' },
|
||||
);
|
||||
return t("{id} isn't reporting now — showing where it was at {time}", {
|
||||
id,
|
||||
time,
|
||||
});
|
||||
return { message: t(notices.at, { time }), detail };
|
||||
}
|
||||
|
||||
/** Own initial share restoration, durable layer state and restoration notices. */
|
||||
@@ -183,7 +237,7 @@ export class ShareRestoration {
|
||||
this.syncShareState();
|
||||
if (this.shareLinkManager?.rejectedShareCode)
|
||||
this._presentAfterStartupCover(
|
||||
t("This share link can't be opened"),
|
||||
{ message: t("This share link can't be opened") },
|
||||
++this._shareTrackingNoticeGeneration,
|
||||
);
|
||||
}
|
||||
@@ -413,7 +467,7 @@ export class ShareRestoration {
|
||||
this._presentAfterStartupCover(
|
||||
view.lastKnown
|
||||
? sharedFixNotice(view.entity, view.lastKnown.observedAtMs)
|
||||
: t('Shared vessel is unavailable'),
|
||||
: { message: t('Shared vessel is unavailable') },
|
||||
++this._shareTrackingNoticeGeneration,
|
||||
);
|
||||
return false;
|
||||
@@ -506,26 +560,36 @@ export class ShareRestoration {
|
||||
// A share link that knows where the entity was says so; the view is
|
||||
// already there.
|
||||
const fix = this._sharedThingFor(result)?.lastKnown;
|
||||
const message = fix
|
||||
const notice = fix
|
||||
? sharedFixNotice(
|
||||
this._initialShareState.shareView.entity,
|
||||
fix.observedAtMs,
|
||||
)
|
||||
: shareTrackingRestoreNotice(result);
|
||||
: { message: shareTrackingRestoreNotice(result) };
|
||||
if (this._resolveInitialShareRestore) {
|
||||
void this.initialRestorePromise.then(() =>
|
||||
this._presentAfterStartupCover(message, noticeGeneration),
|
||||
this._presentAfterStartupCover(notice, noticeGeneration),
|
||||
);
|
||||
return;
|
||||
}
|
||||
this._presentAfterStartupCover(message, noticeGeneration);
|
||||
this._presentAfterStartupCover(notice, noticeGeneration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a status notice once the start-up cover is gone, unless a newer
|
||||
* notice (generation) has taken its place.
|
||||
* notice (generation) has taken its place. A notice with a detail line is
|
||||
* a last-known one: the sentence over the entity's id.
|
||||
* @param {{message: string, detail?: string}} notice
|
||||
* @param {number} noticeGeneration
|
||||
*/
|
||||
_presentAfterStartupCover(message, noticeGeneration) {
|
||||
_presentAfterStartupCover(notice, noticeGeneration) {
|
||||
const show = () =>
|
||||
notice.detail
|
||||
? this.showStatus(notice.message, {
|
||||
state: 'last-known',
|
||||
detail: notice.detail,
|
||||
})
|
||||
: this.showStatus(notice.message);
|
||||
const showAfterStartupCover = () => {
|
||||
this._lifetime.frame(() => {
|
||||
if (
|
||||
@@ -541,7 +605,7 @@ export class ShareRestoration {
|
||||
!startupCover ||
|
||||
getComputedStyle(startupCover).visibility === 'hidden'
|
||||
) {
|
||||
this.showStatus(message);
|
||||
show();
|
||||
return;
|
||||
}
|
||||
let fallbackTimer = null;
|
||||
@@ -556,7 +620,7 @@ export class ShareRestoration {
|
||||
this._disposed,
|
||||
)
|
||||
)
|
||||
this.showStatus(message);
|
||||
show();
|
||||
};
|
||||
removeStartupListener = this._lifetime.listen(
|
||||
startupCover,
|
||||
|
||||
Reference in new issue
Block a user