Explosion_der_Spiele/scripts/levels/farm_path.gd
copilot 1cc8aa9b9d Add village 3D wiring, voice lines, and 1.74 m world scale.
Houses ~8.5 m; chimps capped ~0.85 m with safer axis fitting. Large GLB/PBR packs stay local until Git LFS (Forgejo HTTP 413).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 12:02:57 +02:00

52 lines
1.8 KiB
GDScript

extends Node3D
## Enger Weg + Gabelung. Rechts = Magier (Knockback / Planet destroy).
var _went_right: bool = false
func _ready() -> void:
GameState.current_scene_id = "farm_path"
GameState.heal_full()
_went_right = bool(GameState.get_flag("went_right_first", false))
var left := get_node_or_null("LeftExit")
if left:
left.set("use_goto_next", false)
left.set("next_scene_id", "")
if left.has_signal("body_entered") and not left.body_entered.is_connected(_on_left_body):
left.body_entered.connect(_on_left_body)
var right := get_node_or_null("RightZone")
if right:
right.set("use_goto_next", false)
right.set("next_scene_id", "")
if right.has_signal("body_entered") and not right.body_entered.is_connected(_on_right_body):
right.body_entered.connect(_on_right_body)
func _on_left_body(body: Node3D) -> void:
if not body.is_in_group("player"):
return
if _went_right or GameState.get_flag("went_right_first", false):
GameState.set_flag("farmer_mood", "detour")
else:
GameState.set_flag("farmer_mood", "direct")
GameState.set_flag("planet_destroyed", false)
GameState.goto_scene("farm")
func _on_right_body(body: Node3D) -> void:
if not body.is_in_group("player"):
return
_went_right = true
GameState.set_flag("went_right_first", true)
var ui := get_node_or_null("/root/UIRoot")
# Knockback toward left path
if body is CharacterBody3D:
body.global_position += Vector3(-4, 0, 0)
if GameState.get_flag("called_black_mage", false):
GameState.set_flag("mage_angered", true)
GameState.set_flag("planet_destroyed", true)
if ui and ui.has_method("show_dialog"):
ui.show_dialog_key("dialog_mage_angry", 4.0)
await get_tree().create_timer(2.0).timeout
GameState.goto_scene("moon")
else:
GameState.set_flag("called_black_mage", true)
if ui and ui.has_method("show_dialog"):
ui.show_dialog_key("dialog_mage_push")