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.
60 lines
1.8 KiB
GDScript
60 lines
1.8 KiB
GDScript
extends Area3D
|
|
|
|
@export var poi_name: String = "Tor zur Mitte"
|
|
@export var marker_color: Color = Color(1.0, 0.9, 0.4)
|
|
@export var required_group: String = "region1_pois"
|
|
@export var target_position: Vector3 = Vector3.ZERO
|
|
|
|
@onready var sprite: AnimatedSprite3D = $AnimatedSprite3D
|
|
@onready var name_label: Label3D = $Billboard/NameLabel
|
|
@onready var prompt: Label3D = $Billboard/InteractionPrompt
|
|
|
|
var player_nearby: bool = false
|
|
|
|
func _ready() -> void:
|
|
prompt.visible = false
|
|
prompt.text = "[F] Interact"
|
|
name_label.text = poi_name
|
|
_update_visuals()
|
|
body_entered.connect(_on_body_entered)
|
|
body_exited.connect(_on_body_exited)
|
|
|
|
func _all_required_visited() -> bool:
|
|
var pois := get_tree().get_nodes_in_group(required_group)
|
|
if pois.is_empty():
|
|
return false
|
|
for poi in pois:
|
|
if not poi.visited:
|
|
return false
|
|
return true
|
|
|
|
func _update_visuals() -> void:
|
|
if _all_required_visited():
|
|
sprite.modulate = marker_color
|
|
else:
|
|
sprite.modulate = marker_color * Color(0.4, 0.4, 0.4, 1.0)
|
|
|
|
func _on_body_entered(body: Node3D) -> void:
|
|
if body.is_in_group("player"):
|
|
player_nearby = true
|
|
prompt.visible = true
|
|
_update_visuals()
|
|
|
|
func _on_body_exited(body: Node3D) -> void:
|
|
if body.is_in_group("player"):
|
|
player_nearby = false
|
|
prompt.visible = false
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if player_nearby and Input.is_action_just_pressed("interact"):
|
|
_try_transition()
|
|
|
|
func _try_transition() -> void:
|
|
if _all_required_visited():
|
|
InteractionManager.open_message(self, poi_name, "Du betrittst die Mitte der Insel.")
|
|
var player := get_tree().get_first_node_in_group("player")
|
|
if player:
|
|
player.global_position = target_position
|
|
else:
|
|
InteractionManager.open_message(self, poi_name, "Hier geht es noch nicht weiter.\nErst müssen alle sechs Orte dieser Region erkundet sein.")
|