- Tray chips name their card in bold, dark text; how it was rolled follows, muted. - The card inspector lists Threads in (from which card and result) and Threads out (from which result, to which card); click one to select it. - A range typed backwards (start above end) is no longer swapped: the card warns and its die is greyed out until it's fixed. - Save as template… can replace one of your templates; the template list's Rename became Edit… (name, description, fill-in labels). - Spread ▾ export: the Table Tarot file first, other formats in a submenu. - Test spread section hints in plain words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.9 KiB
GDScript
50 lines
1.9 KiB
GDScript
class_name InspectorThreads
|
|
extends RefCounted
|
|
## The card inspector's "Threads in" and "Threads out" lists: every thread
|
|
## leading into the card (from which card and result) and out of it (from
|
|
## which result, to which card). Clicking one selects that thread.
|
|
|
|
|
|
static func build(insp: Inspector, box: VBoxContainer, t: RollTable) -> void:
|
|
var board := insp.main.data
|
|
var ins := VBoxContainer.new()
|
|
for src in board.tables:
|
|
for e in src.entries:
|
|
if e.pipes.has(t.id):
|
|
ins.add_child(_link(insp, src, e, t.id, "%s · %s" % [_name(src.name), _result(e)]))
|
|
var outs := VBoxContainer.new()
|
|
for e in t.entries:
|
|
for to in e.pipes:
|
|
var target := board.get_table(to)
|
|
outs.add_child(_link(insp, t, e, to, "%s → %s" % [_result(e), _name(target.name) if target else to + " (missing)"]))
|
|
if ins.get_child_count() == 0:
|
|
ins.add_child(InspectorKit.note("Nothing leads here yet."))
|
|
if outs.get_child_count() == 0:
|
|
outs.add_child(InspectorKit.note("No threads leave this card."))
|
|
box.add_child(InspectorKit.field("Threads in (%d)" % _count(ins), ins))
|
|
box.add_child(InspectorKit.field("Threads out (%d)" % _count(outs), outs))
|
|
|
|
|
|
static func _link(insp: Inspector, from: RollTable, e: TableEntry, to: String, text: String) -> Button:
|
|
var key := Roller.pipe_key(from.id, e.id, to)
|
|
var b := InspectorKit.link(text, "Select this thread")
|
|
b.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
b.clip_text = true
|
|
b.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
var own := str(e.pipe_color.get(to, ""))
|
|
if own != "":
|
|
b.add_theme_color_override("font_color", Color(own))
|
|
b.pressed.connect(func() -> void: insp.main.inspecting.select_pipe(key))
|
|
return b
|
|
|
|
|
|
static func _count(v: VBoxContainer) -> int:
|
|
return v.get_children().filter(func(c: Node) -> bool: return c is Button).size()
|
|
|
|
|
|
static func _name(s: String) -> String:
|
|
return Inspector._title_of(s, "(no name)")
|
|
|
|
|
|
static func _result(e: TableEntry) -> String:
|
|
return Inspector._title_of(e.text, "(no text)")
|