Explosion_der_Spiele/scripts/combat/exit_trigger.gd
copilot 938cc4bc82 Initial scaffold: Godot 4.3 scenes, systems, and placeholders.
Wire all twelve levels with billboard prefabs, autoload systems (inventory, achievements, mock shop, DE/EN/BY), and satire audio locks so the Title→End flow is playable with placeholder assets.
2026-09-14 18:36:02 +02:00

25 lines
777 B
GDScript

extends Area3D
class_name ExitTrigger
## Walk into this volume to advance or jump to a scene.
@export var next_scene_id: String = ""
@export var use_goto_next: bool = true
@export var require_flag: String = ""
func _ready() -> void:
body_entered.connect(_on_body_entered)
collision_layer = 0
collision_mask = 2 # player layer
func _on_body_entered(body: Node3D) -> void:
if not body.is_in_group("player"):
return
if require_flag != "" and not GameState.get_flag(require_flag, false):
var ui := get_node_or_null("/root/UIRoot")
if ui and ui.has_method("show_dialog"):
ui.show_dialog(Locale.tr_key("exit_hint") + " (?)")
return
if use_goto_next and next_scene_id == "":
GameState.goto_next()
elif next_scene_id != "":
GameState.goto_scene(next_scene_id)