Files
settled-reach/client/ui/implant/widgets/system_index.gd
T
jpmschweitzerandClaude Opus 4.6 48c8fb7dea fix(ui): PR #131 review round 2 — manifest cleanup, system index helper, stderr help
Addresses 6 mechanical issues from PR review:

- ImplantAppManifest: drop dead display_name and icon_path fields.
  default_key carries a TODO noting its future migration to a keybinds
  manifest (input concern in app manifest is a layering violation,
  tracked explicitly).
- default_mode wire format is now a String ("fullscreen" / "insert") for
  mod-author discovery. ImplantRegistry parses via _MODE_MAP, caches the
  resolved int in _resolved_modes, and exposes get_resolved_mode(app_path).
  main.gd reads the resolved int directly instead of re-parsing.
- Extract client/ui/implant/widgets/system_index.gd (class_name SystemIndex,
  static get_sorted_systems). Removes duplicated star_map_data.json loader +
  sort lambda from atlas_app and economics overview_screen.
- ImplantApp.on_insert_deactivated() default auto-closes only when the app
  is active in INSERT mode. FULLSCREEN apps no longer spuriously close on
  insert state changes.
- tooling/db/sqlite-query and sqlite-exec: --help output goes to stderr
  (exit 0). Keeps stdout reserved for JSON payloads so JSON-parsing
  callers can't get silently corrupted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-19 14:21:03 +02:00

32 lines
1012 B
GDScript

class_name SystemIndex
## Shared system data loader for implant apps (#844).
## Static helper — call as SystemIndex.get_sorted_systems().
const DATA_PATH := "res://data/star_map_data.json"
static func get_sorted_systems() -> Array:
if not FileAccess.file_exists(DATA_PATH):
push_warning("SystemIndex: %s not found" % DATA_PATH)
return []
var file := FileAccess.open(DATA_PATH, FileAccess.READ)
if file == null:
push_warning("SystemIndex: could not open %s" % DATA_PATH)
return []
var parsed: Variant = JSON.parse_string(file.get_as_text())
file.close()
if not (parsed is Dictionary):
return []
var nodes: Array = []
for node: Dictionary in parsed.get("nodes", []):
var sid: String = node.get("system_id", "")
if not sid.is_empty():
nodes.append(node)
nodes.sort_custom(
func(a: Dictionary, b: Dictionary) -> bool:
var na: String = a.get("proper_name", a.get("system_id", ""))
var nb: String = b.get("proper_name", b.get("system_id", ""))
return na < nb
)
return nodes