1

Add station info

This commit is contained in:
Evan Pratten 2024-02-02 13:17:02 -05:00
parent 50dda12817
commit cb25b28fbf
7 changed files with 609 additions and 141 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

View File

@ -1,32 +0,0 @@
import re
import json
import argparse
from pathlib import Path
ap = argparse.ArgumentParser()
ap.add_argument("type", type=str, help="Type of the map", choices=["surface", "caves", "draconic-surface"])
args = ap.parse_args()
TILES_DIR = Path(__file__).parent / "tiles" / args.type
tiles = list(TILES_DIR.glob("*.png"))
TILE_PARTS_RE = re.compile(r"([\d\-]+)_([\d\-]+)_x([\d\-]+)_z([\d\-]+).png")
for tile in tiles:
tile_name = tile.name
match = TILE_PARTS_RE.match(tile_name)
if match:
chunk_x, chunk_z, x, z = match.groups()
print(
json.dumps(
{
"chunk_x": int(chunk_x),
"chunk_z": int(chunk_z),
"x": int(x),
"z": int(z),
"image": tile_name
}
) + ","
)

View File

@ -1,103 +1,5 @@
const TILE_SIZE = 1024;
const WAYPOINTS = {
subway_stations: [
{ x: -252, z: -433, name: "Northern & Bee Station" },
{ x: -220, z: -186, name: "Monument Place Station" },
{ x: -236, z: -181, name: "[ZOG] Zombie Grinder Station" },
{ x: -204, z: 578, name: "[PMI] Prismarine Inn Station" },
{ x: -322, z: 364, name: "[DSW] Dismal Swamp Station" },
{ x: -322, z: 41, name: "[APY] Apiary Station" },
{ x: -316, z: 43, name: "[APY] Apiary Station" },
{ x: -270, z: 5, name: "Southwest Blvd" },
{ x: -263, z: -45, name: "Southlands" },
{ x: -263, z: -85, name: "Three Sisters" },
{ x: -268, z: -127, name: "Small Hall Station" },
{ x: -256, z: -151, name: "Monument Place Station" },
{ x: -256, z: -180, name: "Zombie Grinder Station" },
{ x: -242, z: -227, name: "DOJO St Station" },
{ x: -202, z: -229, name: "New Cornick House Station" },
{ x: -184, z: -243, name: "Wintergarden Station" },
{ x: 225, z: -293, name: "[PRU] Pine Ruins Station" },
{ x: 143, z: -291, name: "[CSD] Canalside Station" },
{ x: -213, z: -264, name: "Spawn Central Station" },
{ x: -510, z: 137, name: "[SWL] Southwest Landing Station" },
{ x: -326, z: 41, name: "[APY] Apiary Station" },
{ x: -229, z: -181, name: "[ZOG] Zombie Grinder Station" },
{ x: -27, z: 63, name: "[WCP] Whitecaps Station" },
{ x: -27, z: 7, name: "[MTV] Mountain Village Station" },
{ x: -31, z: -237, name: "[ESJ] Eastside Transfer" },
{ x: -245, z: -49, name: "[SOU] Southlands Terminal" },
{ x: -218, z: -137, name: "Monument Place Station" },
{ x: -213, z: -252, name: "Spawn Central Station" },
{ x: -899, z: -607, name: "Mountain Station" },
{ x: -900, z: -4187, name: "Mensa Club Station" },
{ x: -900, z: -2320, name: "Un-Named Interchange" },
{ x: -1630, z: -2316, name: "Farmington Station" },
{ x: -2143, z: -2315, name: "Village Layover Station" },
{ x: -2135, z: -1015, name: "Twin Peaks Station" },
{ x: -2143, z: -1523, name: "Witchy Swamp Station" },
{ x: -2726, z: -186, name: "Ocean Overlook Station" },
{ x: -2111, z: -186, name: "Un-Named Interchange" },
{ x: 927, z: 1223, name: "End Portal Station" },
{ x: -1048, z: -94, name: "Craniumslows Station" },
{ x: -1048, z: -186, name: "Un-Named Interchange" },
{ x: -1375, z: -188, name: "Un-Named Interchange" },
{ x: -1372, z: 507, name: "Sheep Station" },
{ x: -1372, z: 659, name: "Cow Station" },
{ x: -1033, z: 1087, name: "Un-Named Interchange" },
{ x: -1372, z: 1088, name: "South Station" },
{ x: -1568, z: 909, name: "1567 Station" },
{ x: -1372, z: 908, name: "Magenta Station" },
{ x: -980, z: 907, name: "Un-Named Interchange" },
{ x: -891, z: -187, name: "Un-Named Interchange" },
{ x: -700, z: -185, name: "Dark Oak Station" },
{ x: -536, z: -187, name: "Cat Ave Station" },
{ x: -220, z: 1176, name: "End of Line" },
{ x: -220, z: 6, name: "Unknown Station" },
{ x: -219, z: -254, name: "Spawn Glider Port Station" },
{ x: -219, z: -375, name: "Bell Bridge / Changa Station" },
{ x: -219, z: -481, name: "Eccentric Genius Station" },
{ x: -219, z: -552, name: "Xiled Station" },
{ x: -219, z: -650, name: "Nopantsistan Station" },
{ x: -220, z: -1797, name: "[HLV] Highland Village Station" },
{ x: -187, z: -1254, name: "[MSW] Mid-Swamp Station" },
{ x: -187, z: -782, name: "[JOT] Jotaku Station" },
{ x: -197, z: -719, name: "[NSX] Northside Transfer Station" },
{ x: -217, z: -275, name: "Spawn Central Station" },
{ x: -245, z: -366, name: "[NRV] North River Station" },
{ x: -245, z: -258, name: "[CMK] Central Market Station" },
{ x: -219, z: -137, name: "Monument Place Station" },
{ x: -220, z: -137, name: "Monument Place Station" },
{ x: -120, z: -481, name: "Survey Hall Station" },
{ x: -143, z: -304, name: "Inventory Station" },
{ x: -115, z: -256, name: "Spawn Square Station" },
{ x: 63, z: -215, name: "Tek Square Station" },
{ x: -36, z: -225, name: "Manor Ave Station" },
{ x: -141, z: -225, name: "Spawn Square Station" },
{ x: -221, z: -226, name: "DOJO St Station" },
{ x: -389, z: -222, name: "Mob St Station" },
{ x: -491, z: -222, name: "[CAT] Cat Ave Station" },
{ x: -624, z: 310, name: "Garfield Station" },
{ x: -616, z: -222, name: "Castle Square Station" },
{ x: -187, z: -373, name: "[CHA] Changa Station" },
{ x: -187, z: -477, name: "[ECG] Eccentric Genius" },
{ x: -187, z: -575, name: "[XIL] Xiled Station" },
{ x: -187, z: -662, name: "[NOP] Nopantsistan Station" },
{ x: -187, z: -720, name: "[NSX] Northside Transfer" },
{ x: -245, z: -665, name: "[NPN] Nopantsistan Station" },
{ x: -245, z: -543, name: "[LAY] Laydros Station" },
{ x: -900, z: -1992, name: "Red Station" },
{ x: -72, z: -1946, name: "[NSC] North Shore City Terminal" },
{ x: -183, z: -1949, name: "[NSJ] North Shore Junction" },
{ x: -187, z: -1736, name: "[HLV] Highland Village Station" },
{ x: -187, z: -1519, name: "[NDK] North Docks Station" },
{ x: -187, z: -839, name: "[BOH] Boathouse Station" },
{ x: -189, z: -321, name: "[RST] Riverside Station" },
{ x: -213, z: -258, name: "Spawn Central Station" },
]
}
// Set up the map
var map = L.map('map', {
@ -106,7 +8,7 @@ var map = L.map('map', {
maxZoom: 3,
backgroundColor: '#000000',
});
map.attributionControl.addAttribution('With help from: DraconicNEO');
map.attributionControl.addAttribution('With help from: DraconicNEO');
// Create storage for the tile layers
var layers = {
@ -134,8 +36,52 @@ fetch('/map-data/minecraft/mc-sdf-org/tiles/surface/tiles.json')
});
});
// Create overlay layers
var overlayLayers = {
"Subway Stations": L.layerGroup().addTo(map),
"Subway Lines": L.layerGroup().addTo(map),
}
var clickable_areas = L.layerGroup().addTo(map);
// Add markers
fetch('/map-data/minecraft/mc-sdf-org/markers.json')
.then(response => response.json())
.then(markers => {
// Subway Stations
markers.waypoints.subway_stations.forEach(waypoint => {
var marker = L.marker([waypoint.z * -1, waypoint.x], { icon: L.icon({ iconUrl: '/map-data/icons/subway.png', iconSize: [16, 16], }) }).addTo(overlayLayers["Subway Stations"]);
marker.bindPopup(waypoint.name);
});
// Subway Lines
markers.lines.subway_lines.forEach(line => {
// Iterate over each point pair
line.point_pairs.forEach(pair => {
var map_line_obj = L.polyline([
[pair.from.z * -1, pair.from.x],
[pair.to.z * -1, pair.to.x],
], {
color: line.color,
opacity: 0.5,
}).addTo(overlayLayers["Subway Lines"]);
map_line_obj.bindPopup(line.name);
});
});
// Areas
markers.areas.forEach(area => {
var bounds = [
[area.top_left.z * -1, area.top_left.x],
[area.bottom_right.z * -1, area.bottom_right.x],
];
var area_obj = L.rectangle(bounds, {color:"#00000000", fillOpacity: 0.2 }).addTo(clickable_areas);
area_obj.bindPopup(area.name);
});
});
// Add the layers to the map
L.control.layers(layers).addTo(map);
L.control.layers(layers, overlayLayers).addTo(map);
// Make the viewport look at the center of the map
map.fitBounds([
@ -145,19 +91,34 @@ map.fitBounds([
// Add a CSS rule to pixelate the image only when zoomed in
map.on('zoomend', function (e) {
let element = document.querySelector('#leaflet-pixelator');
if (map.getZoom() >= 2) {
if (document.querySelector('#leaflet-pixelator')) return;
if (element) return;
document.head.insertAdjacentHTML('beforeend', '<style id="leaflet-pixelator">.leaflet-image-layer { image-rendering: pixelated; }</style>');
} else {
document.querySelector('#leaflet-pixelator').remove();
if (element) {
element.remove();
}
}
});
// Create a mouse position display
var mousePosition = L.control({ position: 'bottomleft' });
mousePosition.onAdd = function (map) {
this._div = L.DomUtil.create('div', 'mouse-position');
this._div.style.padding = '5px';
this._div.style.backgroundColor = 'rgba(255, 255, 255, 0.5)';
this._div.style.border = '1px solid #000000';
this._div.style.borderRadius = '5px';
this._div.style.display = 'none';
return this._div;
};
mousePosition.addTo(map);
// // Add waypoints
// var subway_stations = L.layerGroup();
// WAYPOINTS.subway_stations.forEach(waypoint => {
// var marker = L.marker([waypoint.z * -1, waypoint.x]).addTo(subway_stations);
// marker.bindPopup(waypoint.name);
// });
// Update the mouse position display
map.on('mousemove', function (e) {
var x = Math.floor(e.latlng.lng);
var z = Math.floor(e.latlng.lat * -1);
mousePosition._div.innerHTML = `X: ${x}, Z: ${z}`;
mousePosition._div.style.display = '';
});

View File

@ -0,0 +1,539 @@
{
"waypoints": {
"subway_stations": [
{
"x": -252,
"z": -433,
"name": "Northern & Bee Station"
},
{
"x": -220,
"z": -186,
"name": "Monument Place Station"
},
{
"x": -236,
"z": -181,
"name": "[ZOG] Zombie Grinder Station"
},
{
"x": -204,
"z": 578,
"name": "[PMI] Prismarine Inn Station"
},
{
"x": -322,
"z": 364,
"name": "[DSW] Dismal Swamp Station"
},
{
"x": -322,
"z": 41,
"name": "[APY] Apiary Station"
},
{
"x": -316,
"z": 43,
"name": "[APY] Apiary Station"
},
{
"x": -270,
"z": 5,
"name": "Southwest Blvd"
},
{
"x": -263,
"z": -45,
"name": "Southlands"
},
{
"x": -263,
"z": -85,
"name": "Three Sisters"
},
{
"x": -268,
"z": -127,
"name": "Small Hall Station"
},
{
"x": -256,
"z": -151,
"name": "Monument Place Station"
},
{
"x": -256,
"z": -180,
"name": "Zombie Grinder Station"
},
{
"x": -242,
"z": -227,
"name": "DOJO St Station"
},
{
"x": -202,
"z": -229,
"name": "New Cornick House Station"
},
{
"x": -184,
"z": -243,
"name": "Wintergarden Station"
},
{
"x": 225,
"z": -293,
"name": "[PRU] Pine Ruins Station"
},
{
"x": 143,
"z": -291,
"name": "[CSD] Canalside Station"
},
{
"x": -213,
"z": -264,
"name": "Spawn Central Station"
},
{
"x": -510,
"z": 137,
"name": "[SWL] Southwest Landing Station"
},
{
"x": -326,
"z": 41,
"name": "[APY] Apiary Station"
},
{
"x": -229,
"z": -181,
"name": "[ZOG] Zombie Grinder Station"
},
{
"x": -27,
"z": 63,
"name": "[WCP] Whitecaps Station"
},
{
"x": -27,
"z": 7,
"name": "[MTV] Mountain Village Station"
},
{
"x": -31,
"z": -237,
"name": "[ESJ] Eastside Transfer"
},
{
"x": -245,
"z": -49,
"name": "[SOU] Southlands Terminal"
},
{
"x": -218,
"z": -137,
"name": "Monument Place Station"
},
{
"x": -213,
"z": -252,
"name": "Spawn Central Station"
},
{
"x": -899,
"z": -607,
"name": "Mountain Station"
},
{
"x": -900,
"z": -4187,
"name": "Mensa Club Station"
},
{
"x": -1630,
"z": -2316,
"name": "Farmington Station"
},
{
"x": -2143,
"z": -2315,
"name": "Village Layover Station"
},
{
"x": -2135,
"z": -1015,
"name": "Twin Peaks Station"
},
{
"x": -2143,
"z": -1523,
"name": "Witchy Swamp Station"
},
{
"x": -2726,
"z": -186,
"name": "Ocean Overlook Station"
},
{
"x": 927,
"z": 1223,
"name": "End Portal Station"
},
{
"x": -1048,
"z": -94,
"name": "Craniumslows Station"
},
{
"x": -1372,
"z": 507,
"name": "Sheep Station"
},
{
"x": -1372,
"z": 659,
"name": "Cow Station"
},
{
"x": -1372,
"z": 1088,
"name": "South Station"
},
{
"x": -1568,
"z": 909,
"name": "1567 Station"
},
{
"x": -1372,
"z": 908,
"name": "Magenta Station"
},
{
"x": -700,
"z": -185,
"name": "Dark Oak Station"
},
{
"x": -536,
"z": -187,
"name": "Cat Ave Station"
},
{
"x": -220,
"z": 1176,
"name": "End of Line"
},
{
"x": -220,
"z": 6,
"name": "Unknown Station"
},
{
"x": -219,
"z": -254,
"name": "Spawn Glider Port Station"
},
{
"x": -219,
"z": -375,
"name": "Bell Bridge / Changa Station"
},
{
"x": -219,
"z": -481,
"name": "Eccentric Genius Station"
},
{
"x": -219,
"z": -552,
"name": "Xiled Station"
},
{
"x": -219,
"z": -650,
"name": "Nopantsistan Station"
},
{
"x": -220,
"z": -1797,
"name": "[HLV] Highland Village Station"
},
{
"x": -187,
"z": -1254,
"name": "[MSW] Mid-Swamp Station"
},
{
"x": -187,
"z": -782,
"name": "[JOT] Jotaku Station"
},
{
"x": -197,
"z": -719,
"name": "[NSX] Northside Transfer Station"
},
{
"x": -217,
"z": -275,
"name": "Spawn Central Station"
},
{
"x": -245,
"z": -366,
"name": "[NRV] North River Station"
},
{
"x": -245,
"z": -258,
"name": "[CMK] Central Market Station"
},
{
"x": -219,
"z": -137,
"name": "Monument Place Station"
},
{
"x": -220,
"z": -137,
"name": "Monument Place Station"
},
{
"x": -120,
"z": -481,
"name": "Survey Hall Station"
},
{
"x": -143,
"z": -304,
"name": "Inventory Station"
},
{
"x": -115,
"z": -256,
"name": "Spawn Square Station"
},
{
"x": 63,
"z": -215,
"name": "Tek Square Station"
},
{
"x": -36,
"z": -225,
"name": "Manor Ave Station"
},
{
"x": -141,
"z": -225,
"name": "Spawn Square Station"
},
{
"x": -221,
"z": -226,
"name": "DOJO St Station"
},
{
"x": -389,
"z": -222,
"name": "Mob St Station"
},
{
"x": -491,
"z": -222,
"name": "[CAT] Cat Ave Station"
},
{
"x": -624,
"z": 310,
"name": "Garfield Station"
},
{
"x": -616,
"z": -222,
"name": "Castle Square Station"
},
{
"x": -187,
"z": -373,
"name": "[CHA] Changa Station"
},
{
"x": -187,
"z": -477,
"name": "[ECG] Eccentric Genius"
},
{
"x": -187,
"z": -575,
"name": "[XIL] Xiled Station"
},
{
"x": -187,
"z": -662,
"name": "[NOP] Nopantsistan Station"
},
{
"x": -187,
"z": -720,
"name": "[NSX] Northside Transfer"
},
{
"x": -245,
"z": -665,
"name": "[NPN] Nopantsistan Station"
},
{
"x": -245,
"z": -543,
"name": "[LAY] Laydros Station"
},
{
"x": -900,
"z": -1992,
"name": "Red Station"
},
{
"x": -72,
"z": -1946,
"name": "[NSC] North Shore City Terminal"
},
{
"x": -183,
"z": -1949,
"name": "[NSJ] North Shore Junction"
},
{
"x": -187,
"z": -1736,
"name": "[HLV] Highland Village Station"
},
{
"x": -187,
"z": -1519,
"name": "[NDK] North Docks Station"
},
{
"x": -187,
"z": -839,
"name": "[BOH] Boathouse Station"
},
{
"x": -189,
"z": -321,
"name": "[RST] Riverside Station"
},
{
"x": -213,
"z": -258,
"name": "Spawn Central Station"
}
]
},
"lines": {
"subway_lines": [
{
"name": "Skytrain",
"color": "red",
"point_pairs": [
{
"from": {
"x": 927,
"z": 1223
},
"to": {
"x": 927,
"z": -186
}
},
{
"from": {
"x": 927,
"z": -186
},
"to": {
"x": -4395,
"z": -186
}
},
{
"from": {
"x": -890,
"z": -186
},
"to": {
"x": -890,
"z": -322
}
},
{
"from": {
"x": -890,
"z": -322
},
"to": {
"x": -899,
"z": -322
}
},
{
"from": {
"x": -899,
"z": -322
},
"to": {
"x": -899,
"z": -4187
}
},
{
"from": {
"x": -1048,
"z": -186
},
"to": {
"x": -1048,
"z": -95
}
},
{
"from": {
"x": -1371,
"z": -186
},
"to": {
"x": -1371,
"z": 1087
}
},
{
"from": {
"x": -1371,
"z": 1087
},
"to": {
"x": -1033,
"z": 1087
}
}
]
}
]
},
"areas": [
{
"name": "Spawn",
"top_left": {
"x": -147,
"z": -266
},
"bottom_right": {
"x": -126,
"z": -245
}
}
]
}