wayfarers_wanderer/autoload/interaction_manager.gd
Jonas Reith c6d7e6c84e Restructure project into boot/autoload/world/player folders
Flat root layout replaced with a domain-based structure:
- autoload/    the two existing singleton scripts (InteractionManager,
               InteractionUI) — grouped by role, matching project.godot's
               [autoload] section
- world/       the flying island: terrain.gd, and world/poi/ for the POI
               marker + gate scripts/scenes
- player/      everything about the player as a character: player.gd/.tscn,
               camera_rig.gd (it only exists to follow the player)
- boot/        created empty for now, will hold the opening/menu screens

main.tscn renamed to world/island.tscn — "main" stops making sense once
the actual run/main_scene becomes a boot screen (next commit). Verified
via grep that main.tscn was referenced nowhere else by path (only by UID
elsewhere, which self-heals).

Every .gd got its .uid sidecar moved alongside it. Two ext_resource
entries had no UID (poi_gate.tscn's own script ref, and island.tscn's
ref to poi_gate.tscn) and needed their path= fixed by hand; everything
else is UID-based and resolved itself after a project reimport.

Also removed two untracked-looking but actually committed editor temp
files (preview_scene.tscn*.tmp, leftovers from the unused hterrain
addon, referenced nowhere).

Verified headless: all 8 affected scenes (island, poi, poi_gate,
player, interaction_ui, and the three debug prototypes that reference
moved files) load with exit code 0. No behavior change, pure move.
2026-08-27 09:18:17 +02:00

47 lines
1.3 KiB
GDScript
Executable File

extends Node
signal interaction_opened
signal interaction_closed
var active: bool = false
var current_poi: Node = null
func open_poi(poi: Node) -> void:
active = true
current_poi = poi
InteractionUI.show_menu(poi.poi_name, _get_main_options())
func _get_main_options() -> Array:
return [
{ "label": "Erkunden", "action": "explore" },
{ "label": "Ausruhen", "action": "rest" },
{ "label": "Beenden", "action": "close" },
]
func handle_selection(action: String) -> void:
match action:
"explore":
# Platzhalter, bis echte Erkunden-Events pro POI existieren
InteractionUI.show_text("Das wurde besucht.")
"rest":
InteractionUI.show_text("Du rastest eine Weile...\nDu fühlst dich erholt.")
"close":
close()
_:
# POI-spezifische Aktionen (z.B. Ja/Nein bei einem Portal)
if current_poi and current_poi.has_method("handle_interaction_action"):
current_poi.handle_interaction_action(action)
# Für POIs außerhalb des generischen Menüs (z.B. Portale): Panel mit reinem
# Info-Text öffnen, ohne die Erkunden/Ausruhen/Beenden-Optionen.
func open_message(poi: Node, title: String, text: String) -> void:
active = true
current_poi = poi
InteractionUI.show_menu(title, [])
InteractionUI.show_text(text)
func close() -> void:
active = false
current_poi = null
InteractionUI.hide_menu()