extends Node3D ## Enddorf: Hausbau + Zahnionär. Kein Happy End. func _ready() -> void: GameState.current_scene_id = "end_screen" GameState.heal_full() var ui := get_node_or_null("/root/UIRoot") if ui and ui.has_method("show_dialog"): ui.show_dialog_key("dialog_end_angry", 4.0) var house := get_node_or_null("HouseSpot") if house and house.has_signal("interacted"): house.interacted.connect(_on_house) var dentist := get_node_or_null("DentistHeist") if dentist and dentist.has_signal("interacted"): dentist.interacted.connect(_on_heist) # Plot marker stays small until built — don't show full house twice _setup_plot_marker() if GameState.house_built or GameState.get_flag("house_built", false): _show_house() func _setup_plot_marker() -> void: var spot := get_node_or_null("HouseSpot") if spot == null: return if GameState.house_built or GameState.get_flag("house_built", false): return # Before build: small plot sign, not a second full-size house spot.set("billboard_height", 1.0) spot.set("billboard_max_width", 1.5) var bill = spot.get_node_or_null("BillboardSprite") if bill: bill.set("max_width", 1.5) if bill.has_method("set_target_height"): bill.set_target_height(1.0) func _on_house(_n: Node = null) -> void: GameState.house_built = true GameState.set_flag("house_built", true) _show_house() var ui := get_node_or_null("/root/UIRoot") if ui and ui.has_method("show_dialog"): ui.show_dialog(Locale.tr_key("build_house")) func _show_house() -> void: ## One house only: grow HouseSpot to full size (no duplicate BuiltHouse). var spot := get_node_or_null("HouseSpot") if spot == null: return spot.set("billboard_height", SpriteFit.WORLD_HOUSE_HEIGHT) spot.set("billboard_max_width", SpriteFit.WORLD_HOUSE_MAX_WIDTH) spot.set("texture_path", "res://assets/sprites/placeholders/house.png") _fit_house_billboard(spot) # Remove legacy duplicate if any var dup := get_node_or_null("BuiltHouse") if dup: dup.queue_free() func _fit_house_billboard(node: Node) -> void: var bill = node.get_node_or_null("BillboardSprite") if bill == null: return bill.set("max_width", SpriteFit.WORLD_HOUSE_MAX_WIDTH) if bill.has_method("set_target_height"): bill.set_target_height(SpriteFit.WORLD_HOUSE_HEIGHT) if bill.has_method("set_texture"): var tex: Texture2D = load("res://assets/sprites/placeholders/house.png") if tex: bill.set_texture(tex) func _on_heist(_n: Node = null) -> void: Inventory.add_item("tooth", 100) Achievements.unlock("tooth_millionaire") var ui := get_node_or_null("/root/UIRoot") if ui and ui.has_method("show_dialog"): ui.show_dialog_key("dialog_toothionaire", 4.0)