Add tentacled boss planet encounter

This commit is contained in:
Loïc Wisniewski 2026-09-03 10:33:05 +02:00
commit 40f284dcdd
38 changed files with 1051 additions and 19 deletions

View file

@ -0,0 +1,18 @@
[gd_resource type="Resource" script_class="PlanetSurfaceProfile" load_steps=4 format=3]
[ext_resource type="Script" path="res://surface/PlanetSurfaceProfile.gd" id="1"]
[ext_resource type="Shader" path="res://shaders/boss_surface.gdshader" id="2"]
[ext_resource type="PackedScene" path="res://boss/BossEncounter.tscn" id="3"]
[resource]
script = ExtResource("1")
profile_id = "boss"
encounter_scene = ExtResource("3")
editor_visible = false
show_capture_status = false
background_shader = ExtResource("2")
base_color = Color(0.055, 0.008, 0.05, 1)
crater_color = Color(0.16, 0.018, 0.10, 1)
highlight_color = Color(0.16, 0.66, 0.72, 1)
caption_color = Color(0.95, 0.62, 0.82, 1)
caption_outline_color = Color(0.025, 0.005, 0.025, 0.95)

View file

@ -12,9 +12,13 @@ extends Label
const PLANET_DEFINITIONS = preload("res://planets/PlanetDefinitions.gd")
var _was_conquered: bool = false
var display_enabled: bool = true
func _process(_delta: float) -> void:
if not display_enabled:
visible = false
return
var planet_id: String = GameState.planet_id
var total: int = GameState.total_capture_points(planet_id)
if total <= 0:

View file

@ -97,7 +97,9 @@ var pan_start_camera: Vector2 = Vector2.ZERO
func _ready() -> void:
_profile_ids = PlanetSurfaceProfiles.PROFILES.keys()
# Scripted encounters own their layout and rules, so their profiles opt
# out rather than being special-cased here.
_profile_ids = PlanetSurfaceProfiles.editor_profile_ids()
back_button.pressed.connect(func(): get_tree().change_scene_to_file("res://ui/MainMenu.tscn"))
profile_button.pressed.connect(_on_profile_pressed)
reward_button.pressed.connect(_on_reward_pressed)

View file

@ -49,6 +49,12 @@ func _compose_surface(profile: Resource) -> void:
var caption: Label = get_node(caption_path)
caption.add_theme_color_override("font_color", profile.caption_color)
caption.add_theme_color_override("font_outline_color", profile.caption_outline_color)
var capture_label: Label = get_node("../UI/CaptureLabel")
# This controller readies before the UI sibling. Store the policy on the
# label itself so its first process tick cannot make a scripted encounter's
# deliberately hidden generic objective readout visible again.
capture_label.display_enabled = bool(profile.show_capture_status)
capture_label.visible = bool(profile.show_capture_status)
if profile.features_scene != null:
var features: Node = profile.features_scene.instantiate()
feature_host.add_child(features)
@ -64,7 +70,7 @@ func _compose_surface(profile: Resource) -> void:
var setup_host: Node = SETUP_HOST_SCENE.instantiate()
feature_host.add_child(setup_host)
setup_host.apply_setup(setup)
else:
elif profile.encounter_scene == null:
# No PlanetSetup exists for this profile at all (#55: "void" has
# none authored) - register zero required points directly, rather
# than leaving this planet's conquest state unregistered forever.
@ -75,6 +81,10 @@ func _compose_surface(profile: Resource) -> void:
# points() treats a total of 0 as vacuously already conquered.
GameState.register_capture_points(GameState.planet_id, 0)
if profile.encounter_scene != null:
var encounter: Node = profile.encounter_scene.instantiate()
feature_host.add_child(encounter)
func _on_exit_pressed() -> void:
if transitioning:

View file

@ -6,6 +6,12 @@ extends Resource
@export var profile_id: String = "rocky"
@export var features_scene: PackedScene
# Optional self-contained gameplay encounter. Unlike an authored PlanetSetup,
# this owns its own objectives and layout and is therefore not configurable in
# the setup editor.
@export var encounter_scene: PackedScene
@export var editor_visible: bool = true
@export var show_capture_status: bool = true
# Which shader draws this surface's backdrop. Every profile names one - the
# old "null means keep whatever the scene already had" convention is what let
# the game and the setup editor drift apart, since each scene "already had" a

View file

@ -7,8 +7,17 @@ const PROFILES: Dictionary = {
"gas": preload("res://surface/GasSurfaceProfile.tres"),
"void": preload("res://surface/VoidSurfaceProfile.tres"),
"research_lab": preload("res://surface/ResearchLabSurfaceProfile.tres"),
"boss": preload("res://surface/BossSurfaceProfile.tres"),
}
static func get_profile(profile_id: String) -> Resource:
return PROFILES.get(profile_id, PROFILES[DEFAULT_PROFILE_ID])
static func editor_profile_ids() -> Array:
var result: Array = []
for profile_id in PROFILES:
if bool(PROFILES[profile_id].editor_visible):
result.append(profile_id)
return result