feat(ui): atlas implant panel — system picker, orbital diagram, body nav (#834)
3-level atlas navigation as an implant/map/atlas FULLSCREEN app (D-170 z=20): system picker (◄ ► cycle, Enter opens orbital) → orbital diagram (star centre, bodies grouped by orbit_index with moons sub-orbiting parents, stations as markers, click-to-open body or mini station panel) → body entry (data sheet, Enter stub for #835 heightmap viewer, Esc back). Composed from the ImplantPanel component library (D-169). Wires the panel into hud.tscn, adds an A-key toggle in main.gd, propagates insert_state via snapshot_consumers. Extends generate-star-map-data.py to emit per-system orbit_bodies + stations arrays (with currency_zone, atmosphere, population, terrain_reference, etc.) from systems.db; star_map_data.json regenerated deterministically. Per D-191 §6, Phase 3.
This commit is contained in:
@@ -164,7 +164,7 @@ def generate() -> dict:
|
||||
cur = conn.cursor()
|
||||
|
||||
cur.execute(
|
||||
"SELECT system_id, proper_name, geographic_sector, geographic_band "
|
||||
"SELECT system_id, proper_name, geographic_sector, geographic_band, currency_zone "
|
||||
"FROM star_systems"
|
||||
)
|
||||
db_lookup = {row["system_id"]: dict(row) for row in cur.fetchall()}
|
||||
@@ -192,6 +192,50 @@ def generate() -> dict:
|
||||
# Economic tier for GDP calculation
|
||||
cur.execute("SELECT system_id, economic_tier FROM system_economy")
|
||||
econ_tiers = {row["system_id"]: row["economic_tier"] for row in cur.fetchall()}
|
||||
|
||||
# Per-system body list for atlas orbital diagram (D-191 §6)
|
||||
cur.execute("""
|
||||
SELECT system_id, body_id, parent_body_id, orbit_index, body_type,
|
||||
proper_name, atmosphere, inhabited, population,
|
||||
terrain_reference, mass_class
|
||||
FROM bodies
|
||||
ORDER BY system_id, orbit_index
|
||||
""")
|
||||
orbit_bodies_by_system: dict = {}
|
||||
for row in cur.fetchall():
|
||||
sid_ = row["system_id"]
|
||||
orbit_bodies_by_system.setdefault(sid_, []).append({
|
||||
"body_id": row["body_id"],
|
||||
"parent_body_id": row["parent_body_id"],
|
||||
"orbit_index": row["orbit_index"],
|
||||
"body_type": row["body_type"],
|
||||
"proper_name": row["proper_name"],
|
||||
"atmosphere": row["atmosphere"],
|
||||
"inhabited": bool(row["inhabited"]),
|
||||
"population": int(row["population"] or 0),
|
||||
"terrain_reference": row["terrain_reference"],
|
||||
"mass_class": row["mass_class"],
|
||||
})
|
||||
|
||||
# Per-system station list for atlas orbital diagram (D-191 §6)
|
||||
cur.execute("""
|
||||
SELECT system_id, station_id, orbits_body_id, station_type,
|
||||
proper_name, population, governance_type, economic_role
|
||||
FROM stations
|
||||
ORDER BY system_id
|
||||
""")
|
||||
stations_by_system: dict = {}
|
||||
for row in cur.fetchall():
|
||||
sid_ = row["system_id"]
|
||||
stations_by_system.setdefault(sid_, []).append({
|
||||
"station_id": row["station_id"],
|
||||
"orbits_body_id": row["orbits_body_id"],
|
||||
"station_type": row["station_type"],
|
||||
"proper_name": row["proper_name"],
|
||||
"population": int(row["population"] or 0),
|
||||
"governance_type": row["governance_type"],
|
||||
"economic_role": row["economic_role"],
|
||||
})
|
||||
except sqlite3.Error as e:
|
||||
print(f"ERROR: systems.db query failed: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
@@ -227,6 +271,11 @@ def generate() -> dict:
|
||||
if wiki["star_type"]:
|
||||
entry["star_type"] = wiki["star_type"]
|
||||
|
||||
# Currency zone from star_systems
|
||||
cz = db.get("currency_zone", "")
|
||||
if cz:
|
||||
entry["currency_zone"] = cz
|
||||
|
||||
# Bodies + population from systems.db (authoritative, not wiki)
|
||||
bs = body_stats.get(sid, {})
|
||||
ss = station_stats.get(sid, {})
|
||||
@@ -245,6 +294,11 @@ def generate() -> dict:
|
||||
entry["gttr_excerpt"] = gttr
|
||||
if n.get("is_gateway"):
|
||||
entry["is_gateway"] = True
|
||||
|
||||
# Atlas orbital diagram data (D-191 §6) — per-body and per-station arrays
|
||||
entry["orbit_bodies"] = orbit_bodies_by_system.get(sid, [])
|
||||
entry["stations"] = stations_by_system.get(sid, [])
|
||||
|
||||
nodes.append(entry)
|
||||
|
||||
nodes.sort(key=lambda x: (x["hop_distance"], x["system_id"]))
|
||||
@@ -257,7 +311,7 @@ def generate() -> dict:
|
||||
"generated_from": "star-map.json + systems.db + wiki/star-systems",
|
||||
"system_count": len(nodes),
|
||||
"edge_count": len(star_map["edges"]),
|
||||
"note": "Client-side star map data. Regenerate with: tooling/generate-star-map-data.py",
|
||||
"note": "Client-side star map + atlas orbital data. Regenerate with: tooling/generate-star-map-data.py",
|
||||
},
|
||||
"nodes": nodes,
|
||||
"edges": star_map["edges"],
|
||||
|
||||
Reference in New Issue
Block a user