@tool class_name DatingProfileControl extends Control static var _details_format_str: String = "[b]%s[/b] [font_size=45]%s[/font_size]" static var _bullet_format_str: String = "• %s" static var _distance_format_str: String = "%s miles away" @export var profile: DatingProfile: set(p): if profile != null: profile.changed.disconnect(_on_profile_changed) profile = p profile.changed.connect(_on_profile_changed) _on_profile_changed() func _on_profile_changed(): # TODO: why aren't these unique names instantiated at the start? if get_node_or_null("%details") == null: return if profile == null: %pic.texture = null %details.text = "" %blurb.text = "" return %pic.texture = profile.pic var details: Array[String] = [] details.append(_details_format_str % [profile.name, profile.age]) for detail: String in [profile.job, profile.education]: if not detail.is_empty(): details.append(_bullet_format_str % detail) details.append(_bullet_format_str % (_distance_format_str % profile.distance_away)) %details.text = "\n".join(details) %blurb.text = profile.bio