From 26aa5fa67941776cbc25b7a0a59e25025c0fa61e Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Wed, 20 Aug 2025 21:04:26 +0300 Subject: [PATCH] easter egg implemented, discover a hidden surprise on the map Signed-off-by: Uncle Fatso --- package.json | 2 +- src/components/Map/Map.tsx | 109 +++++++++++++++++++++++++++++++++++-- 2 files changed, 105 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index c5fa746..81c91f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghost-telemetry-frontend", - "version": "0.1.11", + "version": "0.1.12", "author": "Uncle f4tso ", "license": "GPL-3.0", "description": "Ghost Telemetry frontend", diff --git a/src/components/Map/Map.tsx b/src/components/Map/Map.tsx index da513c6..2a00c77 100644 --- a/src/components/Map/Map.tsx +++ b/src/components/Map/Map.tsx @@ -25,6 +25,88 @@ interface MapState { left: number; } +const funnyLocations = [ + [-68.7700, 38.0100], + [-66.7700, 38.0100], + [-64.7700, 38.0100], + [-62.7700, 38.0100], + [-60.7700, 38.0100], + [-68.7700, 36.0100], + [-68.7700, 34.0100], + [-68.7700, 32.0100], + [-68.7700, 30.0100], + [-66.7700, 30.0100], + [-64.7700, 30.0100], + [-62.7700, 30.0100], + [-60.7700, 30.0100], + [-60.7700, 34.0100], + [-60.7700, 36.0100], + [-60.7700, 38.0100], + + [-54.7700, 38.0100], + [-54.7700, 36.0100], + [-54.7700, 34.0100], + [-54.7700, 32.0100], + [-54.7700, 30.0100], + [-50.7700, 38.0100], + [-50.7700, 36.0100], + [-50.7700, 34.0100], + [-50.7700, 32.0100], + [-50.7700, 30.0100], + [-54.7700, 34.0100], + [-53.7700, 34.0100], + [-52.7700, 34.0100], + [-51.7700, 34.0100], + [-50.7700, 34.0100], + + [-44.7700, 38.0100], + [-42.7700, 38.0100], + [-40.7700, 38.0100], + [-38.7700, 38.0100], + [-36.7700, 38.0100], + [-44.7700, 36.0100], + [-36.7700, 36.0100], + [-44.7700, 34.0100], + [-36.7700, 34.0100], + [-44.7700, 32.0100], + [-36.7700, 32.0100], + [-44.7700, 30.0100], + [-36.7700, 30.0100], + [-44.7700, 30.0100], + [-42.7700, 30.0100], + [-40.7700, 30.0100], + [-38.7700, 30.0100], + [-36.7700, 30.0100], + + [-30.7700, 38.0100], + [-28.7700, 38.0100], + [-26.7700, 38.0100], + [-24.7700, 38.0100], + [-22.7700, 38.0100], + [-30.7700, 36.0100], + [-30.7700, 34.0100], + [-28.7700, 34.0100], + [-26.7700, 34.0100], + [-24.7700, 34.0100], + [-22.7700, 34.0100], + [-22.7700, 32.0100], + [-22.7700, 30.0100], + [-24.7700, 30.0100], + [-26.7700, 30.0100], + [-28.7700, 30.0100], + [-30.7700, 30.0100], + + [-18.7700, 38.0100], + [-16.7700, 38.0100], + [-14.7700, 38.0100], + [-12.7700, 38.0100], + [-10.7700, 38.0100], + [-14.7700, 36.0100], + [-14.7700, 34.0100], + [-14.7700, 32.0100], + [-14.7700, 30.0100], +] + export class WorldMap extends React.Component { public state: MapState = { filter: null, @@ -36,6 +118,7 @@ export class WorldMap extends React.Component { public unknowns: Map = new Map(); public offsets: Map = new Map(); + public usedFunnyIndexes: Set = new Set; public usedLeftPositions: Set = new Set(); public usedTopPositions: Set = new Set(); @@ -60,23 +143,36 @@ export class WorldMap extends React.Component {
{nodes.map(node => { + let isRealPoint = true; let { lat, lon } = node; const focused = filter == null || filter(node); if (lat == null || lon == null) { // Skip nodes with unknown location + isRealPoint = false; const unknown = this.unknowns.get(node.name); if (unknown) { lat = unknown.lat as Types.Latitude; lon = unknown.lon as Types.Longitude; } else { - lat = parseFloat((Math.random() * 22.0315 + 27.2936).toFixed(4)) as Types.Latitude; - lon = parseFloat((Math.random() * 21.2696 - 55.9863).toFixed(4)) as Types.Longitude; + if (this.usedFunnyIndexes.size >= funnyLocations.length) { + lat = parseFloat((Math.random() * 31.4630 - 37.4840).toFixed(4)) as Types.Latitude; + lon = parseFloat((Math.random() * 49.2187 - 40.3147).toFixed(4)) as Types.Longitude; + } else { + let index = 0; + while (this.usedFunnyIndexes.has(index)) { + index = Math.floor(Math.random() * funnyLocations.length) + } + const point = funnyLocations[index]; + lat = point.at(1) as Types.Latitude; + lon = point.at(0) as Types.Longitude; + this.usedFunnyIndexes.add(index); + } this.unknowns.set(node.name, { lat, lon }); } } - const position = this.pixelPosition(node.networkId, lat, lon); + const position = this.pixelPosition(node.networkId, lat, lon, isRealPoint); return ( { id: Maybe, lat: Types.Latitude, lon: Types.Longitude, + isRealPoint: boolean, ): LocationPosition { const { state, offsets, usedLeftPositions, usedTopPositions } = this; @@ -130,8 +227,10 @@ export class WorldMap extends React.Component { leftOffset = Math.floor(Math.random() * 12) - 6; } - left += leftOffset; - top += topOffset; + if (isRealPoint) { + left += leftOffset; + top += topOffset; + } offsets.set(id, { leftOffset, topOffset }); usedLeftPositions.add(left);