Add planet scanner and octopus biome
This commit is contained in:
parent
2ecd61de98
commit
8fbcc340ce
21 changed files with 784 additions and 30 deletions
56
ui/menus/ScannerMenu.gd
Normal file
56
ui/menus/ScannerMenu.gd
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
extends "res://ui/menus/ModalMenu.gd"
|
||||
|
||||
signal scan_requested(definition_id: String)
|
||||
|
||||
const PLANET_DEFINITIONS = preload("res://planets/PlanetDefinitions.gd")
|
||||
|
||||
@onready var status_label: Label = $StatusLabel
|
||||
@onready var progress_label: Label = $ProgressLabel
|
||||
|
||||
var entries: Dictionary = {}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
entries = {
|
||||
PLANET_DEFINITIONS.ROCKY_ID: [$RockyButton, $RockyLabel],
|
||||
PLANET_DEFINITIONS.GAS_GIANT_ID: [$GasButton, $GasLabel],
|
||||
PLANET_DEFINITIONS.BLACK_HOLE_ID: [$BlackHoleButton, $BlackHoleLabel],
|
||||
PLANET_DEFINITIONS.RESEARCH_LAB_ID: [$ResearchButton, $ResearchLabel],
|
||||
PLANET_DEFINITIONS.BOSS_ID: [$BossButton, $BossLabel],
|
||||
}
|
||||
for definition_id in entries:
|
||||
var id: String = String(definition_id)
|
||||
var button: Control = entries[definition_id][0]
|
||||
button.pressed.connect(_request_scan.bind(id))
|
||||
refresh()
|
||||
|
||||
|
||||
func _request_scan(definition_id: String) -> void:
|
||||
scan_requested.emit(definition_id)
|
||||
|
||||
|
||||
func open_menu() -> void:
|
||||
super.open_menu()
|
||||
status_label.text = "Choose a signature to reveal its nearest world."
|
||||
refresh()
|
||||
|
||||
|
||||
func refresh() -> void:
|
||||
var surveyed: int = 0
|
||||
for definition_id in GameState.SCANNER_SURVEY_TYPES:
|
||||
if GameState.visited_planet_kinds.has(definition_id):
|
||||
surveyed += 1
|
||||
var boss_visible: bool = GameState.scanner_can_find_boss()
|
||||
for node in entries[PLANET_DEFINITIONS.BOSS_ID]:
|
||||
node.visible = boss_visible
|
||||
progress_label.text = "PLANETARY SIGNATURES %d / %d" % [surveyed,
|
||||
GameState.SCANNER_SURVEY_TYPES.size()]
|
||||
if not boss_visible:
|
||||
progress_label.text += "\nSurvey every signature to isolate the hostile signal."
|
||||
|
||||
|
||||
func show_failure(definition_id: String) -> void:
|
||||
var definition: Resource = PLANET_DEFINITIONS.get_definition(definition_id)
|
||||
status_label.text = "No %s signature found within scanner range." \
|
||||
% definition.display_name.to_lower()
|
||||
Loading…
Reference in a new issue