wayfarers_wanderer/interaction_manager.gd
Jonas Reith b430d929c5 Rework the gate: smaller, right at the border, locked until ready, Yes/No prompt
- Moved GateToCenter to sit right on the region-1/center table-edge
  border (angle 30° bisector, radius ~13.2, where that edge's chord
  actually sits) instead of a few units inside the region, and scaled
  the instance down to 0.5x.
- target_position now lands just past the border on the table side
  (radius ~11.5 at the same angle) instead of teleporting to the
  absolute island center — "you walked through the gate," not "you
  warped across the map."
- Gate is now genuinely non-interactive while locked: no prompt shown,
  _input() doesn't even check for the key press, and the marker shows
  "Verschlossen" instead of its real name (mirrors poi.gd's existing
  "???" pattern for undiscovered POIs).
- Once unlocked, interacting opens a "Durchgehen?" Ja/Nein menu
  instead of teleporting immediately. Added
  InteractionManager.handle_interaction_action() delegation so POIs
  can own custom menu actions without hardcoding them into the shared
  manager.

Verified headless: locked state hides the prompt and shows
"Verschlossen"; unlocking (all 6 region1_pois visited) restores the
real name and prompt; "Nein" leaves the player position untouched;
"Ja" moves the player to exactly target_position.
2026-08-26 21:38:27 +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()