A2. Controller source: lines 36-70
Finding live GUI controls and maintaining the transcript reader.
var field: LineEdit = control(element_id) as LineEdit
if is_instance_valid(field):
if not field.text_submitted.is_connected(send):
field.text_submitted.connect(send)
var reader: TextEdit = control("story_transcript") as TextEdit
if is_instance_valid(reader):
reader.editable = false
reader.add_theme_color_override("font_readonly_color",
Color("ecdfbf"))
var body: String = "\n\n".join(
Runtime.variables.get("ta_lines", []))
if reader.text != body:
reader.text = body
reader.set_deferred("scroll_vertical",
reader.get_line_count())
sync_view()
sync_world()func text_mode() -> bool:
return bool(Runtime.variables.get("ta_text_mode", true))func sync_view() -> void:
var signature: String = str(text_mode())
if signature == screen_signature:
return
screen_signature = signature
Runtime.set_player_input_enabled(not text_mode())
Runtime.hide_gui("reply_card")
pending_reply = false
Runtime.show_gui("text_screen" if text_mode() else "graph_hud")
Runtime.hide_gui("graph_hud" if text_mode() else "text_screen")
if text_mode():
call_deferred("focus_command")func sync_world() -> void:Continue directly with the next source block.
