Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
class_name ResultTray
|
|
|
|
|
extends PanelContainer
|
|
|
|
|
## The strip along the bottom: the current roll as a chain of result chips
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
## joined by brass pipe pieces, a Copy menu, and on the right either the
|
|
|
|
|
## earlier rolls (default) or the Variables tab.
|
|
|
|
|
|
|
|
|
|
enum Side { EARLIER, VARIABLES }
|
|
|
|
|
|
|
|
|
|
const COPY_TEXT := 0
|
|
|
|
|
const COPY_BBCODE := 1
|
|
|
|
|
const COPY_DETAILS := 2
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
|
|
|
|
var main: Main
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var side: int = Side.EARLIER
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
var _title: Label
|
|
|
|
|
var _again: Button
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var _copy: MenuButton
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
var _flow: HFlowContainer
|
|
|
|
|
var _empty: Label
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var _earlier_box: VBoxContainer
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
var _earlier: VBoxContainer
|
|
|
|
|
var _earlier_empty: Label
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var _vars: VariablesPanel
|
|
|
|
|
var _tab_earlier: Button
|
|
|
|
|
var _tab_vars: Button
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
var _shown_for: Dictionary = {}
|
|
|
|
|
var _shown_count := 0
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
var _scroll: ScrollContainer
|
|
|
|
|
var _halt: PanelContainer
|
|
|
|
|
var _halt_label: Label
|
|
|
|
|
var _headline: PanelContainer
|
|
|
|
|
var _headline_cap: Label
|
|
|
|
|
var _headline_text: RichTextLabel
|
2026-11-08 17:11:19 -06:00
|
|
|
var _headline_scroll: ScrollContainer
|
|
|
|
|
const HEADLINE_W := 420.0
|
|
|
|
|
const HEADLINE_MAX_H := 220.0
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
## True when "+N earlier steps" has been opened for the current roll.
|
|
|
|
|
var expanded := false
|
|
|
|
|
var _scroll_to_end := false
|
|
|
|
|
|
|
|
|
|
## A long chain shows only its last steps; the rest sit behind a toggle.
|
|
|
|
|
const TAIL := 12
|
|
|
|
|
## Most chips shown even when expanded (a chain may have thousands).
|
|
|
|
|
const MAX_EXPANDED := 300
|
|
|
|
|
## The chips area scrolls past this height instead of pushing the board up.
|
|
|
|
|
const MAX_FLOW_HEIGHT := 200.0
|
|
|
|
|
## Most effect lines listed under one chip.
|
|
|
|
|
const EFFECT_LINES := 3
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func setup(p_main: Main) -> void:
|
|
|
|
|
main = p_main
|
|
|
|
|
var sb := Style.box(Style.FELT_DEEP, 0, [16, 14, 16, 16])
|
|
|
|
|
sb.border_width_top = 1
|
|
|
|
|
sb.border_color = Color(1, 1, 1, 0.08)
|
|
|
|
|
add_theme_stylebox_override("panel", sb)
|
|
|
|
|
|
|
|
|
|
var h := HBoxContainer.new()
|
|
|
|
|
h.add_theme_constant_override("separation", 28)
|
|
|
|
|
add_child(h)
|
|
|
|
|
|
|
|
|
|
var now := VBoxContainer.new()
|
|
|
|
|
now.add_theme_constant_override("separation", 10)
|
|
|
|
|
now.size_flags_horizontal = SIZE_EXPAND_FILL
|
|
|
|
|
h.add_child(now)
|
|
|
|
|
var head := HBoxContainer.new()
|
|
|
|
|
head.add_theme_constant_override("separation", 12)
|
|
|
|
|
now.add_child(head)
|
|
|
|
|
_title = Style.make_label("RESULT", Style.caps(), 12, Style.ON_FELT_MUTED)
|
|
|
|
|
_title.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
head.add_child(_title)
|
|
|
|
|
_again = Style.bar_button("Roll again")
|
2026-11-08 12:53:39 -06:00
|
|
|
_again.tooltip_text = "Shift-click to skip the animation"
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
_again.pressed.connect(func() -> void:
|
|
|
|
|
if not main.current.is_empty():
|
|
|
|
|
main.start_roll(main.current["root"])
|
|
|
|
|
)
|
|
|
|
|
head.add_child(_again)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
_copy = _make_copy_menu()
|
|
|
|
|
head.add_child(_copy)
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
_halt = PanelContainer.new()
|
|
|
|
|
_halt.add_theme_stylebox_override("panel", Style.box(Style.WARN_BG, 8, [10, 3, 10, 4]))
|
|
|
|
|
_halt.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
_halt_label = Style.make_label("", Style.body_bold(), 14, Style.WARN_INK)
|
|
|
|
|
_halt.add_child(_halt_label)
|
|
|
|
|
_halt.hide()
|
|
|
|
|
head.add_child(_halt)
|
|
|
|
|
|
|
|
|
|
# A chain that reached a sheet card leads with the rendered sheet.
|
|
|
|
|
_headline = PanelContainer.new()
|
|
|
|
|
var hsb := Style.box(Style.CARD, 10, [16, 10, 16, 12])
|
|
|
|
|
Style.bordered(hsb, 2, Style.BRASS)
|
|
|
|
|
_headline.add_theme_stylebox_override("panel", hsb)
|
|
|
|
|
_headline.size_flags_horizontal = SIZE_SHRINK_BEGIN
|
|
|
|
|
var hv := VBoxContainer.new()
|
|
|
|
|
hv.add_theme_constant_override("separation", 2)
|
|
|
|
|
_headline.add_child(hv)
|
|
|
|
|
_headline_cap = Style.make_label("", Style.body(), 12, Style.MUTED)
|
|
|
|
|
hv.add_child(_headline_cap)
|
2026-11-08 17:11:19 -06:00
|
|
|
# A sheet wraps at a fixed width and scrolls past HEADLINE_MAX_H, so a long
|
|
|
|
|
# sheet can't widen the window or take over the tray.
|
|
|
|
|
_headline_text = RichText.label("", 17, Style.INK, false, true)
|
|
|
|
|
_headline_text.custom_minimum_size = Vector2(HEADLINE_W, 0)
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
RichText.hook_hover(_headline_text, main)
|
2026-11-08 17:11:19 -06:00
|
|
|
_headline_scroll = ScrollContainer.new()
|
|
|
|
|
_headline_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
|
|
|
|
|
_headline_scroll.custom_minimum_size = Vector2(HEADLINE_W + 12, 0)
|
|
|
|
|
_headline_scroll.add_child(_headline_text)
|
|
|
|
|
hv.add_child(_headline_scroll)
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
_headline.hide()
|
|
|
|
|
_headline.size_flags_vertical = SIZE_SHRINK_BEGIN
|
|
|
|
|
# The headline sits left of the chips, so a sheet doesn't make the tray taller.
|
|
|
|
|
var body_row := HBoxContainer.new()
|
|
|
|
|
body_row.add_theme_constant_override("separation", 14)
|
|
|
|
|
now.add_child(body_row)
|
|
|
|
|
body_row.add_child(_headline)
|
|
|
|
|
|
|
|
|
|
_scroll = ScrollContainer.new()
|
|
|
|
|
_scroll.size_flags_horizontal = SIZE_EXPAND_FILL
|
|
|
|
|
_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
|
|
|
|
|
_scroll.custom_minimum_size = Vector2(0, 58)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
_flow = HFlowContainer.new()
|
|
|
|
|
_flow.add_theme_constant_override("h_separation", 0)
|
|
|
|
|
_flow.add_theme_constant_override("v_separation", 8)
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
_flow.size_flags_horizontal = SIZE_EXPAND_FILL
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
# Keep the tray's height steady while a new roll's chips arrive.
|
|
|
|
|
_flow.custom_minimum_size = Vector2(0, 58)
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
_flow.minimum_size_changed.connect(_fit_scroll.call_deferred)
|
|
|
|
|
_flow.resized.connect(_fit_scroll.call_deferred)
|
|
|
|
|
_scroll.add_child(_flow)
|
|
|
|
|
body_row.add_child(_scroll)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
_empty = Style.make_label("Click a die on any table to roll.", Style.body(), 16, Style.ON_FELT_MUTED)
|
|
|
|
|
now.add_child(_empty)
|
|
|
|
|
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var right := VBoxContainer.new()
|
|
|
|
|
right.add_theme_constant_override("separation", 8)
|
|
|
|
|
right.custom_minimum_size = Vector2(340, 0)
|
|
|
|
|
h.add_child(right)
|
|
|
|
|
var tabs := HBoxContainer.new()
|
|
|
|
|
tabs.add_theme_constant_override("separation", 14)
|
|
|
|
|
right.add_child(tabs)
|
|
|
|
|
_tab_earlier = _tab("EARLIER")
|
|
|
|
|
_tab_earlier.pressed.connect(func() -> void: set_side(Side.EARLIER))
|
|
|
|
|
tabs.add_child(_tab_earlier)
|
|
|
|
|
_tab_vars = _tab("VARIABLES")
|
|
|
|
|
_tab_vars.tooltip_text = "Saved variables for this collection"
|
|
|
|
|
_tab_vars.pressed.connect(func() -> void: set_side(Side.VARIABLES))
|
|
|
|
|
tabs.add_child(_tab_vars)
|
|
|
|
|
|
|
|
|
|
_earlier_box = VBoxContainer.new()
|
|
|
|
|
_earlier_box.add_theme_constant_override("separation", 6)
|
|
|
|
|
right.add_child(_earlier_box)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
_earlier = VBoxContainer.new()
|
|
|
|
|
_earlier.add_theme_constant_override("separation", 6)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
_earlier_box.add_child(_earlier)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
_earlier_empty = Style.make_label("Older rolls show here.", Style.body(), 15, Style.ON_FELT_MUTED)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
_earlier_box.add_child(_earlier_empty)
|
|
|
|
|
_vars = VariablesPanel.new()
|
|
|
|
|
_vars.setup(main)
|
|
|
|
|
right.add_child(_vars)
|
|
|
|
|
set_side(Side.EARLIER)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _tab(text: String) -> Button:
|
|
|
|
|
var b := Button.new()
|
|
|
|
|
b.text = text
|
|
|
|
|
b.toggle_mode = true
|
|
|
|
|
b.add_theme_font_override("font", Style.caps())
|
|
|
|
|
b.add_theme_font_size_override("font_size", 12)
|
|
|
|
|
var n := Style.box(Color(0, 0, 0, 0), 0, [0, 0, 0, 3])
|
|
|
|
|
var on := Style.box(Color(0, 0, 0, 0), 0, [0, 0, 0, 1])
|
|
|
|
|
on.border_width_bottom = 2
|
|
|
|
|
on.border_color = Style.BRASS
|
|
|
|
|
Style.skin_button(b, n, n, on, Style.ON_FELT_MUTED, Style.ON_FELT, Style.ON_FELT)
|
|
|
|
|
b.add_theme_stylebox_override("focus", Style.box(Color(0, 0, 0, 0)))
|
|
|
|
|
return b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func set_side(s: int) -> void:
|
|
|
|
|
side = s
|
|
|
|
|
_tab_earlier.set_pressed_no_signal(s == Side.EARLIER)
|
|
|
|
|
_tab_vars.set_pressed_no_signal(s == Side.VARIABLES)
|
|
|
|
|
_earlier_box.visible = s == Side.EARLIER
|
|
|
|
|
_vars.visible = s == Side.VARIABLES
|
|
|
|
|
if s == Side.VARIABLES:
|
|
|
|
|
_vars.render()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _make_copy_menu() -> MenuButton:
|
|
|
|
|
var m := MenuButton.new()
|
|
|
|
|
m.text = "Copy"
|
|
|
|
|
m.tooltip_text = "Copy this result"
|
|
|
|
|
m.flat = false
|
|
|
|
|
var normal := Style.bordered(Style.box(Color(1, 1, 1, 0.04), 8, [12, 6, 12, 6]), 1, Color(1, 1, 1, 0.16))
|
|
|
|
|
var hover := Style.bordered(Style.box(Color(1, 1, 1, 0.1), 8, [12, 6, 12, 6]), 1, Color(1, 1, 1, 0.16))
|
|
|
|
|
Style.skin_button(m, normal, hover, hover, Style.ON_FELT)
|
|
|
|
|
m.add_theme_font_size_override("font_size", 15)
|
|
|
|
|
var pm := m.get_popup()
|
|
|
|
|
pm.add_item("Copy as text", COPY_TEXT)
|
|
|
|
|
pm.add_item("Copy as BBCode", COPY_BBCODE)
|
|
|
|
|
pm.add_item("Copy with details", COPY_DETAILS)
|
|
|
|
|
pm.add_theme_stylebox_override("panel", Style.bordered(Style.box(Style.CARD, 8, [6, 6, 6, 6]), 1, Style.RULE))
|
|
|
|
|
pm.add_theme_stylebox_override("hover", Style.box(Style.LIT, 5, [8, 4, 8, 4]))
|
|
|
|
|
pm.add_theme_color_override("font_color", Style.INK)
|
|
|
|
|
pm.add_theme_color_override("font_hover_color", Style.INK)
|
|
|
|
|
pm.add_theme_font_override("font", Style.body())
|
|
|
|
|
pm.add_theme_font_size_override("font_size", 15)
|
|
|
|
|
pm.id_pressed.connect(func(id: int) -> void: main.copy_current(id))
|
|
|
|
|
return m
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func render() -> void:
|
|
|
|
|
var current := main.current
|
|
|
|
|
var steps: Array = current.get("steps", [])
|
|
|
|
|
var fresh_from := 0
|
|
|
|
|
if is_same(current, _shown_for):
|
|
|
|
|
fresh_from = _shown_count
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
else:
|
|
|
|
|
expanded = false
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
_shown_for = current
|
|
|
|
|
_shown_count = steps.size()
|
|
|
|
|
|
|
|
|
|
for c in _flow.get_children():
|
|
|
|
|
_flow.remove_child(c)
|
|
|
|
|
c.queue_free()
|
|
|
|
|
_empty.visible = current.is_empty()
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
_render_status(current, steps)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
if current.is_empty():
|
|
|
|
|
_title.text = "RESULT"
|
|
|
|
|
_again.hide()
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
_copy.hide()
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
else:
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var root_name := Formatter.strip_tags(str(current["root_name"]))
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
_title.text = ("Result · %s" % root_name).to_upper()
|
|
|
|
|
_again.text = "Roll %s again" % root_name
|
|
|
|
|
_again.visible = main.data.get_table(current["root"]) != null
|
|
|
|
|
var done: bool = current.get("done", false)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
_copy.visible = done
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
var first := visible_from(steps.size(), expanded)
|
|
|
|
|
if first > 0 or expanded and steps.size() > TAIL:
|
|
|
|
|
_flow.add_child(_earlier_toggle(first, steps.size()))
|
|
|
|
|
for i in range(first, steps.size()):
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var step: Dictionary = steps[i]
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
if i > first:
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
_flow.add_child(_link(step.get("inline", false)))
|
|
|
|
|
var chip := _chip(step, done and i == steps.size() - 1)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
_flow.add_child(chip)
|
2026-11-08 12:53:39 -06:00
|
|
|
if i >= fresh_from and not current.get("fast", false):
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
chip.modulate.a = 0.3
|
|
|
|
|
create_tween().tween_property(chip, "modulate:a", 1.0, 0.25)
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
var asking := str(current.get("asking", ""))
|
|
|
|
|
if asking != "" and not done:
|
|
|
|
|
if steps.size() > first:
|
|
|
|
|
_flow.add_child(_link(false))
|
|
|
|
|
_flow.add_child(_asking_chip(asking))
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
|
|
|
|
for c in _earlier.get_children():
|
|
|
|
|
_earlier.remove_child(c)
|
|
|
|
|
c.queue_free()
|
|
|
|
|
_earlier_empty.visible = main.history.is_empty()
|
|
|
|
|
for rec in main.history:
|
|
|
|
|
var row := HBoxContainer.new()
|
|
|
|
|
row.add_theme_constant_override("separation", 8)
|
|
|
|
|
var time := Style.make_label(clock(rec["time"]), Style.body(), 14, Style.ON_FELT_MUTED)
|
|
|
|
|
time.custom_minimum_size = Vector2(44, 0)
|
|
|
|
|
time.size_flags_vertical = SIZE_SHRINK_BEGIN
|
|
|
|
|
row.add_child(time)
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
var line := RichText.label(earlier_line(rec), 14, Style.ON_FELT, false)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
line.size_flags_horizontal = SIZE_EXPAND_FILL
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
RichText.hook_hover(line, main)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
row.add_child(line)
|
|
|
|
|
_earlier.add_child(row)
|
|
|
|
|
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
var n := main.variable_names().size()
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
_tab_vars.text = "VARIABLES · %d" % n if n > 0 else "VARIABLES"
|
|
|
|
|
if side == Side.VARIABLES:
|
|
|
|
|
_vars.render()
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
_scroll_to_end = not expanded
|
|
|
|
|
_fit_scroll.call_deferred()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Index of the first chip shown for a chain of `count` steps: only the last
|
|
|
|
|
## TAIL steps of a long chain, or up to MAX_EXPANDED when expanded.
|
|
|
|
|
static func visible_from(count: int, is_expanded: bool) -> int:
|
|
|
|
|
if count <= TAIL:
|
|
|
|
|
return 0
|
|
|
|
|
if is_expanded:
|
|
|
|
|
return maxi(0, count - MAX_EXPANDED)
|
|
|
|
|
return count - TAIL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## One Earlier row: "Root: a → b → c", with only the last few steps of a long
|
|
|
|
|
## chain.
|
|
|
|
|
static func earlier_line(rec: Dictionary) -> String:
|
|
|
|
|
var texts := PackedStringArray()
|
|
|
|
|
var all: Array = rec.get("steps", [])
|
|
|
|
|
var shown := 0
|
|
|
|
|
var skipped := 0
|
|
|
|
|
for k in range(all.size() - 1, -1, -1):
|
|
|
|
|
var s: Dictionary = all[k]
|
|
|
|
|
if s.get("inline", false):
|
|
|
|
|
continue
|
|
|
|
|
if shown >= 6:
|
|
|
|
|
skipped += 1
|
|
|
|
|
continue
|
|
|
|
|
texts.insert(0, RichText.decorate(_one_line(str(s["text"])), true))
|
|
|
|
|
shown += 1
|
|
|
|
|
var lead := "[color=#%s]%s:[/color] " % [Style.ON_FELT_MUTED.to_html(false), RichText.plain(Formatter.strip_tags(str(rec.get("root_name", ""))))]
|
|
|
|
|
if skipped > 0:
|
|
|
|
|
lead += "[color=#%s]… %d earlier →[/color] " % [Style.ON_FELT_MUTED.to_html(false), skipped]
|
|
|
|
|
return lead + " → ".join(texts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The first line of a (sheet's) multi-line text, with "…" when there's more.
|
|
|
|
|
static func _one_line(text: String) -> String:
|
|
|
|
|
var nl := text.find("\n")
|
|
|
|
|
if nl < 0:
|
|
|
|
|
return text
|
|
|
|
|
return Formatter.close_open_tags(text.substr(0, nl)) + " …"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The "Cancelled" / "Stopped after 10,000 actions" pill, and the sheet headline.
|
|
|
|
|
func _render_status(current: Dictionary, steps: Array) -> void:
|
|
|
|
|
var halted := str(current.get("halted", ""))
|
|
|
|
|
if halted == "" and current.get("done", false):
|
|
|
|
|
for k in range(steps.size() - 1, maxi(-1, steps.size() - 4), -1):
|
|
|
|
|
var s: Dictionary = steps[k]
|
|
|
|
|
if s.get("cancelled", false) or s.get("limit", false):
|
|
|
|
|
halted = Formatter.strip_tags(str(s.get("text", "")))
|
|
|
|
|
break
|
|
|
|
|
_halt.visible = halted != ""
|
|
|
|
|
if halted != "":
|
|
|
|
|
_halt_label.text = ("✕ " if halted == Roller.CANCELLED else "⚠ ") + halted
|
|
|
|
|
_halt.tooltip_text = "The roll was cancelled at a question; what came before is kept." if halted == Roller.CANCELLED \
|
|
|
|
|
else "This roll took too many steps, so it stopped; everything up to that point is kept."
|
|
|
|
|
var sheet := sheet_step(steps) if current.get("done", false) else {}
|
|
|
|
|
_headline.visible = not sheet.is_empty()
|
|
|
|
|
if not sheet.is_empty():
|
|
|
|
|
_headline_cap.text = Formatter.strip_tags(str(sheet.get("table", ""))).to_upper()
|
|
|
|
|
_headline_text.text = RichText.decorate(str(sheet.get("text", "")))
|
2026-11-08 17:11:19 -06:00
|
|
|
_fit_headline()
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## The last sheet step of a chain (the headline), or {}.
|
|
|
|
|
static func sheet_step(steps: Array) -> Dictionary:
|
|
|
|
|
for k in range(steps.size() - 1, -1, -1):
|
|
|
|
|
var s: Dictionary = steps[k]
|
|
|
|
|
if str(s.get("kind", "")) == RollTable.KIND_SHEET and not s.get("stop", false):
|
|
|
|
|
return s
|
|
|
|
|
return {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _fit_scroll() -> void:
|
|
|
|
|
if _scroll == null or _flow == null:
|
|
|
|
|
return
|
|
|
|
|
var want := _flow.get_combined_minimum_size().y
|
|
|
|
|
_scroll.custom_minimum_size.y = clampf(want, 58.0, MAX_FLOW_HEIGHT)
|
|
|
|
|
if _scroll_to_end:
|
|
|
|
|
# The newest steps (and an open question) are at the end of the chain.
|
|
|
|
|
_scroll_to_end = false
|
|
|
|
|
await get_tree().process_frame
|
|
|
|
|
await get_tree().process_frame
|
|
|
|
|
if is_instance_valid(_scroll):
|
|
|
|
|
_scroll.scroll_vertical = int(_scroll.get_v_scroll_bar().max_value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## "+N earlier steps" (or "Hide earlier steps") at the start of a long chain.
|
|
|
|
|
func _earlier_toggle(first: int, total: int) -> Control:
|
|
|
|
|
var b := Button.new()
|
|
|
|
|
if expanded:
|
|
|
|
|
b.text = "Hide earlier steps" if first == 0 else "Hide earlier steps (%s not shown)" % _thousands(first)
|
|
|
|
|
else:
|
|
|
|
|
b.text = "+%s earlier steps" % _thousands(first)
|
|
|
|
|
b.tooltip_text = "This chain has %s steps" % _thousands(total)
|
|
|
|
|
b.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
var n := Style.bordered(Style.box(Color(1, 1, 1, 0.04), 8, [12, 6, 12, 6]), 1, Color(1, 1, 1, 0.16))
|
|
|
|
|
var h := Style.bordered(Style.box(Color(1, 1, 1, 0.1), 8, [12, 6, 12, 6]), 1, Color(Style.BRASS, 0.5))
|
|
|
|
|
Style.skin_button(b, n, h, h, Style.ON_FELT_MUTED, Style.ON_FELT)
|
|
|
|
|
b.add_theme_font_size_override("font_size", 14)
|
|
|
|
|
b.pressed.connect(func() -> void:
|
|
|
|
|
expanded = not expanded
|
|
|
|
|
render()
|
|
|
|
|
)
|
|
|
|
|
var wrap := HBoxContainer.new()
|
|
|
|
|
wrap.add_theme_constant_override("separation", 0)
|
|
|
|
|
wrap.add_child(b)
|
|
|
|
|
var gap := Control.new()
|
|
|
|
|
gap.custom_minimum_size = Vector2(10, 0)
|
|
|
|
|
wrap.add_child(gap)
|
|
|
|
|
return wrap
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _thousands(n: int) -> String:
|
|
|
|
|
var s := str(n)
|
|
|
|
|
var out := ""
|
|
|
|
|
while s.length() > 3:
|
|
|
|
|
out = "," + s.substr(s.length() - 3) + out
|
|
|
|
|
s = s.substr(0, s.length() - 3)
|
|
|
|
|
return s + out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## A dashed placeholder chip for the question that is open right now.
|
|
|
|
|
func _asking_chip(title: String) -> Control:
|
|
|
|
|
var p := PanelContainer.new()
|
|
|
|
|
var sb := Style.box(Color(1, 1, 1, 0.05), 9, [12, 7, 12, 8])
|
|
|
|
|
Style.bordered(sb, 1, Color(Style.BRASS, 0.6))
|
|
|
|
|
p.add_theme_stylebox_override("panel", sb)
|
|
|
|
|
p.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
var v := VBoxContainer.new()
|
|
|
|
|
v.add_theme_constant_override("separation", 1)
|
|
|
|
|
p.add_child(v)
|
|
|
|
|
v.add_child(Style.make_label(title, Style.body(), 12, Style.ON_FELT_MUTED))
|
|
|
|
|
v.add_child(Style.make_label("Waiting for your answer…", Style.display(), 20, Style.BRASS))
|
|
|
|
|
return p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The muted line above a chip's text: table name and how it got its result.
|
|
|
|
|
static func caption_for(step: Dictionary) -> String:
|
|
|
|
|
var caption := Formatter.strip_tags(str(step["table"]))
|
|
|
|
|
var num: String = str(step.get("num", ""))
|
|
|
|
|
match str(step.get("kind", "")):
|
|
|
|
|
RollTable.KIND_CHOICE:
|
|
|
|
|
if step.get("cancelled", false):
|
|
|
|
|
pass
|
|
|
|
|
elif step.has("answer"):
|
|
|
|
|
caption += " · answered"
|
|
|
|
|
elif step.get("picked", false):
|
|
|
|
|
caption += " · picked"
|
|
|
|
|
elif step.get("random", false):
|
|
|
|
|
caption += " · random"
|
|
|
|
|
if num != "":
|
|
|
|
|
caption += ", rolled %s on %s" % [num, step.get("dice", "d%d" % int(step.get("die", 0)))]
|
|
|
|
|
RollTable.KIND_LOOP:
|
|
|
|
|
if step.has("pass"):
|
|
|
|
|
caption += " · pass %s" % str(step["pass"])
|
|
|
|
|
elif step.get("after", false):
|
|
|
|
|
caption += " · afterwards"
|
|
|
|
|
RollTable.KIND_SHEET:
|
|
|
|
|
caption += " · sheet"
|
|
|
|
|
_:
|
|
|
|
|
if num != "":
|
|
|
|
|
caption += " · rolled %s on %s" % [num, step.get("dice", "d%d" % int(step.get("die", 0)))]
|
|
|
|
|
if step.get("reshuffled", false):
|
|
|
|
|
caption += " · deck reshuffled"
|
|
|
|
|
if str(step.get("save_as", "")) != "":
|
|
|
|
|
caption += " · saved as {%s}" % step["save_as"]
|
|
|
|
|
return caption
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
|
|
|
|
func _chip(step: Dictionary, last: bool) -> Control:
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var inline: bool = step.get("inline", false)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
var p := PanelContainer.new()
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var sb := Style.box(Style.LIT if last else Style.CARD, 9, [10, 5, 10, 6] if inline else [12, 7, 12, 8])
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
sb.shadow_color = Color(0, 0, 0, 0.25)
|
|
|
|
|
sb.shadow_size = 1
|
|
|
|
|
sb.shadow_offset = Vector2(0, 3)
|
|
|
|
|
if last:
|
|
|
|
|
Style.bordered(sb, 2, Style.BRASS)
|
|
|
|
|
sb.set_expand_margin_all(2)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
if inline:
|
|
|
|
|
sb.bg_color = sb.bg_color.darkened(0.04)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
p.add_theme_stylebox_override("panel", sb)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
p.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
p.mouse_filter = MOUSE_FILTER_PASS
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
var v := VBoxContainer.new()
|
|
|
|
|
v.add_theme_constant_override("separation", 1)
|
|
|
|
|
p.add_child(v)
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
var caption := caption_for(step)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var has_details := main.details().step_has_details(step)
|
|
|
|
|
if has_details:
|
|
|
|
|
caption += " " + RichText.INFO_MARK
|
|
|
|
|
var cap := Style.make_label(caption, Style.body(), 11 if inline else 12, Style.MUTED)
|
|
|
|
|
cap.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
v.add_child(cap)
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
var raw := str(step["text"])
|
|
|
|
|
if str(step.get("kind", "")) == RollTable.KIND_SHEET:
|
|
|
|
|
raw = _one_line(raw)
|
|
|
|
|
if step.has("answer") and Formatter.strip_tags(raw).strip_edges() == "":
|
|
|
|
|
raw = "[i]no answer[/i]"
|
|
|
|
|
var shown := RichText.decorate(raw)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var body := RichText.display_label(shown, 16 if inline else 20, Style.DANGER_INK if step.get("stop", false) else Style.INK)
|
|
|
|
|
if Formatter.strip_tags(shown).length() > 56:
|
|
|
|
|
body.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
body.custom_minimum_size = Vector2(420, 0)
|
|
|
|
|
RichText.hook_hover(body, main)
|
|
|
|
|
v.add_child(body)
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
var fx: Array = step.get("effects", [])
|
|
|
|
|
if not fx.is_empty():
|
|
|
|
|
v.add_child(_effect_lines(fx))
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
if has_details:
|
|
|
|
|
p.mouse_entered.connect(func() -> void: main.details().show_step(p, step))
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
return p
|
|
|
|
|
|
|
|
|
|
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
## The effect log under a chip: a few compact lines, errors in red.
|
|
|
|
|
func _effect_lines(fx: Array) -> Control:
|
|
|
|
|
var box := VBoxContainer.new()
|
|
|
|
|
box.add_theme_constant_override("separation", 0)
|
|
|
|
|
box.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
var shown := 0
|
|
|
|
|
var errors := 0
|
|
|
|
|
for l: Variant in fx:
|
|
|
|
|
var d: Dictionary = l if l is Dictionary else {"text": str(l)}
|
|
|
|
|
var bad: bool = d.get("error", false)
|
|
|
|
|
if bad:
|
|
|
|
|
errors += 1
|
|
|
|
|
# Errors are always listed; ordinary lines up to EFFECT_LINES.
|
|
|
|
|
if shown >= EFFECT_LINES and not bad:
|
|
|
|
|
continue
|
|
|
|
|
var lab := Style.make_label(("⚠ " if bad else "") + str(d.get("text", "")), Style.body_bold() if bad else Style.body(), 12,
|
|
|
|
|
Style.DANGER_INK if bad else Style.COPPER_DARK)
|
|
|
|
|
lab.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
lab.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
|
|
|
lab.custom_minimum_size.x = 0
|
|
|
|
|
box.add_child(lab)
|
|
|
|
|
shown += 1
|
|
|
|
|
var more := fx.size() - shown
|
|
|
|
|
if more > 0:
|
|
|
|
|
box.add_child(Style.make_label("+%d more" % more, Style.body(), 11, Style.MUTED))
|
|
|
|
|
var tip := Effects.log_text(fx)
|
|
|
|
|
box.tooltip_text = "\n".join(tip)
|
|
|
|
|
return box
|
|
|
|
|
|
|
|
|
|
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
func _link(inline: bool = false) -> Control:
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
var link := Panel.new()
|
|
|
|
|
var sb := Style.box(Style.BRASS)
|
|
|
|
|
sb.border_width_top = 2
|
|
|
|
|
sb.border_width_bottom = 2
|
|
|
|
|
sb.border_color = Style.BRASS_DARK
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
if inline:
|
|
|
|
|
sb = Style.box(Color(Style.BRASS, 0.55))
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
link.add_theme_stylebox_override("panel", sb)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
link.custom_minimum_size = Vector2(16, 4) if inline else Vector2(22, 8)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
link.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
link.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
return link
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func clock(unix: float) -> String:
|
|
|
|
|
var bias: int = Time.get_time_zone_from_system().get("bias", 0)
|
|
|
|
|
var d := Time.get_datetime_dict_from_unix_time(int(unix) + bias * 60)
|
|
|
|
|
return "%02d:%02d" % [d["hour"], d["minute"]]
|
2026-11-08 17:11:19 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Sizes the sheet headline's scroll area to its text, up to HEADLINE_MAX_H.
|
|
|
|
|
func _fit_headline() -> void:
|
|
|
|
|
await get_tree().process_frame
|
|
|
|
|
if is_instance_valid(_headline_text):
|
|
|
|
|
_headline_scroll.custom_minimum_size.y = minf(_headline_text.get_content_height(), HEADLINE_MAX_H)
|