Add planet scanner and octopus biome

This commit is contained in:
Loïc Wisniewski 2026-09-04 15:56:07 +02:00
commit 8fbcc340ce
21 changed files with 784 additions and 30 deletions

View file

@ -448,6 +448,46 @@ offset_top = 1554
offset_bottom = 1606
script = ExtResource("price_tag")
[node name="ScannerButton" type="Control" parent="."]
anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = -64
offset_right = 64
offset_top = 1610
offset_bottom = 1738
script = ExtResource("10")
icon = 47
glow_color = Color(0.35, 0.88, 1, 1)
[node name="ScannerLabel" type="Label" parent="."]
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = -150
offset_right = 150
offset_top = 1744
offset_bottom = 1810
theme_override_font_sizes/font_size = 32
autowrap_mode = 2
text = "Planet Scanner"
horizontal_alignment = 1
[node name="ScannerCost" type="Control" parent="."]
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = -60
offset_right = 60
offset_top = 1814
offset_bottom = 1866
script = ExtResource("price_tag")
[node name="CloseButton" type="Control" parent="."]
anchor_left = 1.0
anchor_right = 1.0

56
ui/menus/ScannerMenu.gd Normal file
View 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()

184
ui/menus/ScannerMenu.tscn Normal file
View file

@ -0,0 +1,184 @@
[gd_scene load_steps=3 format=3]
[ext_resource type="Script" path="res://ui/IconButton.gd" id="icon"]
[ext_resource type="Script" path="res://ui/menus/ScannerMenu.gd" id="menu"]
[node name="ScannerMenu" type="Control" groups=["modal_menus"]]
visible = false
mouse_filter = 2
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource("menu")
[node name="Backdrop" type="ColorRect" parent="."]
mouse_filter = 2
anchor_right = 1.0
anchor_bottom = 1.0
color = Color(0.03, 0.03, 0.08, 0.96)
[node name="TitleLabel" type="Label" parent="."]
mouse_filter = 2
anchor_right = 1.0
offset_left = 24.0
offset_top = 24.0
offset_right = -180.0
offset_bottom = 100.0
theme_override_font_sizes/font_size = 42
text = "PLANET SCANNER"
horizontal_alignment = 1
[node name="ProgressLabel" type="Label" parent="."]
mouse_filter = 2
anchor_right = 1.0
offset_left = 36.0
offset_top = 130.0
offset_right = -36.0
offset_bottom = 230.0
theme_override_font_sizes/font_size = 22
theme_override_colors/font_color = Color(0.55, 0.78, 0.86, 1)
text = "PLANETARY SIGNATURES 0 / 4"
horizontal_alignment = 1
autowrap_mode = 2
[node name="RockyButton" type="Control" parent="."]
anchor_left = 0.5
anchor_right = 0.5
offset_left = -276.0
offset_top = 280.0
offset_right = -116.0
offset_bottom = 440.0
script = ExtResource("icon")
icon = 47
glow_color = Color(0.7, 0.65, 0.55, 1)
[node name="RockyLabel" type="Label" parent="."]
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -326.0
offset_top = 448.0
offset_right = -66.0
offset_bottom = 500.0
theme_override_font_sizes/font_size = 28
text = "Rocky planet"
horizontal_alignment = 1
[node name="GasButton" type="Control" parent="."]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 116.0
offset_top = 280.0
offset_right = 276.0
offset_bottom = 440.0
script = ExtResource("icon")
icon = 47
glow_color = Color(0.65, 0.42, 0.9, 1)
[node name="GasLabel" type="Label" parent="."]
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = 66.0
offset_top = 448.0
offset_right = 326.0
offset_bottom = 500.0
theme_override_font_sizes/font_size = 28
text = "Gas giant"
horizontal_alignment = 1
[node name="BlackHoleButton" type="Control" parent="."]
anchor_left = 0.5
anchor_right = 0.5
offset_left = -276.0
offset_top = 560.0
offset_right = -116.0
offset_bottom = 720.0
script = ExtResource("icon")
icon = 47
glow_color = Color(0.55, 0.15, 0.85, 1)
[node name="BlackHoleLabel" type="Label" parent="."]
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -326.0
offset_top = 728.0
offset_right = -66.0
offset_bottom = 780.0
theme_override_font_sizes/font_size = 28
text = "Black hole"
horizontal_alignment = 1
[node name="ResearchButton" type="Control" parent="."]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 116.0
offset_top = 560.0
offset_right = 276.0
offset_bottom = 720.0
script = ExtResource("icon")
icon = 47
glow_color = Color(0.7, 0.2, 0.15, 1)
[node name="ResearchLabel" type="Label" parent="."]
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = 66.0
offset_top = 728.0
offset_right = 326.0
offset_bottom = 810.0
theme_override_font_sizes/font_size = 28
text = "Research Lab"
horizontal_alignment = 1
[node name="BossButton" type="Control" parent="."]
visible = false
anchor_left = 0.5
anchor_right = 0.5
offset_left = -80.0
offset_top = 835.0
offset_right = 80.0
offset_bottom = 995.0
script = ExtResource("icon")
icon = 47
glow_color = Color(0.95, 0.18, 0.58, 1)
[node name="BossLabel" type="Label" parent="."]
visible = false
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -180.0
offset_top = 1003.0
offset_right = 180.0
offset_bottom = 1055.0
theme_override_font_sizes/font_size = 28
text = "Tentacled world"
horizontal_alignment = 1
[node name="StatusLabel" type="Label" parent="."]
mouse_filter = 2
anchor_right = 1.0
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 32.0
offset_top = -170.0
offset_right = -32.0
offset_bottom = -30.0
theme_override_font_sizes/font_size = 26
text = "Choose a signature to reveal its nearest world."
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 2
[node name="CloseButton" type="Control" parent="."]
anchor_left = 1.0
anchor_right = 1.0
offset_left = -164.0
offset_top = 24.0
offset_right = -24.0
offset_bottom = 164.0
script = ExtResource("icon")
icon = 1
glow_color = Color(0.35, 0.88, 1, 1)