wayfarers_wanderer/interaction_ui.gd
Jonas Reith 92f220e208 Populate the first region: 6 placeholder POIs + gated center portal
poi.tscn now uses the checkerboard debug texture instead of the ruins
sprite, and poi.gd gained a marker_color export (multiplied into the
existing visited/undiscovered dimming) so each POI marker can be
tinted a distinct color. Six instances placed inside region k=0's
wedge (angle ~12-48°, radius ~18-38, clear of the border walls),
tagged with the "region1_pois" group, in red/orange/yellow/green/
blue/purple.

Simplified InteractionManager's "Erkunden" content to a plain
placeholder ("Das wurde besucht.") instead of the old random
animal-track flavor text, and removed the now-dead handle_explore()
submenu it drove. Added InteractionManager.open_message() for POIs
that need an info popup without the explore/rest/close menu.

New poi_gate.gd/.tscn: a portal placed near region k=0's table-edge
border. Checks whether every POI in "region1_pois" has been visited;
if not, shows a "not yet" message, otherwise teleports the player to
target_position (the center) — a one-way shortcut past the border
wall rather than an opening in it, matching the "explore everything,
then unlock the way onward" progression the user described (this
pattern will repeat per outer region later).

Verified headless: all 6 POIs register in the group with correct
names/colors, gate refuses the transition at 0/6 and 5/6 visited and
allows it at 6/6, and the teleport lands the player exactly on
target_position.
2026-08-26 21:05:38 +02:00

65 lines
1.8 KiB
GDScript
Executable File

extends CanvasLayer
@onready var panel = $Panel
@onready var title_label = $Panel/TitleLabel
@onready var message_label = $Panel/MessageLabel
@onready var option_container = $Panel/OptionContainer
@onready var hint_label = $Panel/HintLabel
var current_options: Array = []
var selected_index: int = 0
var mode: String = "menu" # "menu" oder "text"
func _ready() -> void:
panel.visible = false
func show_menu(title: String, options: Array) -> void:
mode = "menu"
panel.visible = true
title_label.text = title
message_label.text = ""
hint_label.text = "[ESC/B] Beenden"
current_options = options
selected_index = 0
_rebuild_options()
func show_text(text: String) -> void:
mode = "text"
message_label.text = text
hint_label.text = "[F/A] Weiter [ESC/B] Beenden"
_clear_options()
func hide_menu() -> void:
panel.visible = false
current_options = []
func _rebuild_options() -> void:
_clear_options()
for i in current_options.size():
var btn = Button.new()
btn.text = current_options[i]["label"]
btn.focus_mode = Control.FOCUS_ALL
option_container.add_child(btn)
var action = current_options[i]["action"]
btn.pressed.connect(_on_option_pressed.bind(action))
# Ersten Button fokussieren
if option_container.get_child_count() > 0:
option_container.get_child(0).grab_focus()
func _clear_options() -> void:
for child in option_container.get_children():
child.queue_free()
func _on_option_pressed(action: String) -> void:
InteractionManager.handle_selection(action)
func _input(event: InputEvent) -> void:
if not panel.visible:
return
if Input.is_action_just_pressed("cancel"):
InteractionManager.close()
# Im Text-Mode mit F/A weiterklicken
if mode == "text" and Input.is_action_just_pressed("interact"):
# Zurück zum Hauptmenü
InteractionManager.open_poi(InteractionManager.current_poi)