Randoloot/scripts/planets/distant_expeditions_panel.gd
2026-10-25 12:34:56 +01:00

51 lines
3.2 KiB
GDScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

extends RefCounted
const MENU := preload("res://scripts/planets/freighter_menu.gd")
const DATA := preload("res://scripts/planets/distant_expeditions.gd")
static func build(screen: Control) -> void:
var progress: Resource = screen.captain.expedition
var section := MENU.card(screen._content)
section.name = "DistantExpeditions"
var art := TextureRect.new()
art.texture = load("res://assets/planets/expedition_navigation.png")
art.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
art.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED
art.custom_minimum_size.y = 125
art.clip_contents = true
section.add_child(art)
MENU.label(section, "DALEKIE WYPRAWY / SEKTORY DO ZBADANIA", 16, Color("e9b4fc"))
MENU.label(section, "Główna progresja: poziomy 1–120. HP, tarcze i atak wrogów rosną o 10% wartości bazowej na poziom, po 120 o 20%. Bazowe parametry łupu rosną o 7% na poziom przedmiotu. Bonusy procentowe mają limity. Poziom 1000 to limit techniczny wyposażenia.", 12, MENU.MUTED)
if not GameState.active_distant_map.is_empty():
MENU.label(section, "Trwa wyprawa do sektora %d. Użyj przycisku POWRÓT Z WYPRAWY na pokładzie, aby wrócić do układu startowego przed kolejnym lotem." % GameState.system_level, 12, MENU.GOLD)
return
MENU.label(section, "Sektory poza znanymi szlakami. Podwójna liczba wrogów, jeden boss. Kryształy czasu z każdego wroga. Zwykli wrogowie: mapy i powerbanki po 15%. Boss zawsze zostawia 1 mapę i 1 losowy orb, a dodatkowo ma 5% szansy na Orb replikacji.", 12)
var fuel := MENU.label(section, "", 13, Color("95dce8"))
fuel.name = "ExpeditionFuel"
screen._economy_labels["expedition_fuel"] = fuel
MENU.label(section, "Lot: poziom × 1000 deuteru. Powrót bezpłatny. Mapa zużywa się przy wylocie. Każdy sektor można odwiedzić tylko raz.", 12, MENU.GOLD)
if progress.distant_maps.is_empty():
MENU.label(section, "Brak sektorów do zbadania. Szukaj pustelnika na planecie lub map w łupach z wypraw.", 12, MENU.MUTED)
var maps: Array = progress.distant_maps.values()
maps.sort_custom(func(a,b): return int(a.level)<int(b.level))
for map in maps:
var card := MENU.card(section)
MENU.label(card, "%s / POZIOM %d" % [map.name,map.level], 14, MENU.GOLD)
MENU.label(card, "Źródło: %s · poziom %d" % [map.source_planet,map.source_level], 11, MENU.MUTED)
var cost: int = DATA.fuel_cost(map)
MENU.label(card, "Paliwo: %d deuteru" % cost, 12, Color("95dce8"))
var row := MENU.row(card)
var status := MENU.label(row,"",11)
status.size_flags_horizontal = Control.SIZE_EXPAND_FILL
var map_id := str(map.id)
var fly := MENU.button(row,"LEĆ",func(): screen._travel_to_distant(map_id),true)
fly.name = "FlyDistant_"+map_id.md5_text().substr(0,8)
fly.tooltip_text = "Jednorazowa wyprawa. Zużywa mapę i pobiera %d deuteru." % cost
var refresh_status := func():
var missing := maxf(0.0,cost-progress.deuter)
status.text = "Paliwo gotowe" if missing <= 0 else "Brakuje %.1f deuteru" % missing
fly.disabled = missing > 0
refresh_status.call()
progress.changed.connect(refresh_status)
status.tree_exiting.connect(func():
if progress.changed.is_connected(refresh_status): progress.changed.disconnect(refresh_status)
, CONNECT_ONE_SHOT)