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 TableCard
|
|
|
|
|
extends PanelContainer
|
|
|
|
|
## One table on the board: a header with the collapse toggle, name and die
|
|
|
|
|
## button, then its numbered results. Rebuilt from the RollTable whenever the
|
|
|
|
|
## mode, the table's shape, or (when collapsed) the lit result changes.
|
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
|
|
|
##
|
|
|
|
|
## Logic cards (docs/LOGIC.md) share the layout: a choice card has a "?"
|
|
|
|
|
## badge, its question and its options (or one Answer row); a loop card shows
|
|
|
|
|
## its rule and the Each time / Afterwards rows; a variable card shows its
|
|
|
|
|
## live value and has no rows; a sheet card's one row is its rendered
|
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
|
|
|
## template; a router card has a fork icon in place of the die and one row
|
|
|
|
|
## per case, showing its condition ("if @str >= 8", "Otherwise") with its
|
|
|
|
|
## outlet. Live text (values, sheets, prompts) is only re-rendered by
|
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
|
|
|
## refresh_live(), which Main calls after rolls and edits, never per frame.
|
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
|
|
|
## A pick card whose options come from variables (docs/LOGIC.md §2a) says
|
|
|
|
|
## "Options from @skill_* · where …" (in Play with how many are available
|
|
|
|
|
## now) and has a Chosen row first; any pick option can have a Show only if
|
Plain Build display: plain rules on cards, pipes and tray, Why this?, check/collection/inputs visuals
- RulesView (ui/rules_view.gd): plain-or-text helpers over Describe, reading
Main.rules_plain() when present (else StateStore, else plain; --rules=text
for screenshots) and refreshing on Main.rules_view_changed.
- Cards: effect chips, router cases, option sources, show_if, loop rules,
expression dice and variable kinds read in plain words. Build cards drop the
inline effects / show_if / condition / details editors for plain chips;
result text and names stay inline. Row clicks call main.select_result();
the selected row gets a copper bar (set_selected_entry / inspector_selection).
- Check cards: 2D badge, the rule as a sentence, Success / Failure outlets.
Collection cards: live members and "+ Add" (main.select_card). Inputs:
a dashed "Input Tier · starts at 1" box.
- Pipe labels via Describe.pipe, nudged apart and cut to the gap.
- Tray: plain captions (inputs, checks, cases), effect lines from why facts,
and a "Why this?" button opening a WhyPopover; hovers show the same reasons.
- Previews and the choice pop-up read conditions, effects and option sources
in plain words. Style.rules_switch() for the Plain words / Text switch.
- Describe: empty text reads "empty" ("Loot is not empty").
- tests/test_plain_display.gd; option and choice tests pin the Text view
where they check stored text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:30:55 -06:00
|
|
|
## condition, shown under its row ("only if …").
|
|
|
|
|
##
|
|
|
|
|
## Rules read in plain words (docs/PLAIN.md §6, Describe) or as their stored
|
|
|
|
|
## text, following RulesView.plain(main); cards rebuild on Main's
|
|
|
|
|
## rules_view_changed. Build mode only edits result text and the card's name
|
|
|
|
|
## inline; everything else (effects, conditions, details, card fields) is
|
|
|
|
|
## edited in Main's inspector, so rows show plain chips instead. Clicking a
|
|
|
|
|
## result row in Build calls main.select_result(table id, entry id) when Main
|
|
|
|
|
## has it; the selected row gets a copper bar on its left, from
|
|
|
|
|
## main.inspector_selection() ({"table_id", "entry_id"}) at rebuild time or
|
|
|
|
|
## set_selected_entry(entry id), which the inspector can call on any card.
|
|
|
|
|
##
|
|
|
|
|
## Check cards have a "2D" badge, their rule as a sentence and two outlet rows,
|
|
|
|
|
## Success and Failure. Collection cards list their members with live values
|
|
|
|
|
## (and "+ Add" in Build, which selects the card for the inspector). A card
|
|
|
|
|
## with inputs shows them in a dashed box under the header.
|
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
|
|
|
|
|
|
|
|
const WIDTH := 256.0
|
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 mode has more controls per row, so cards are a little wider there.
|
|
|
|
|
const BUILD_WIDTH := 300.0
|
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
|
|
|
const LONG_LIST := 12
|
|
|
|
|
const LIST_HEIGHT := 432.0
|
|
|
|
|
const INLET_Y := 30.0
|
|
|
|
|
|
|
|
|
|
var main: Main
|
|
|
|
|
var table: RollTable
|
|
|
|
|
## entry id -> row PanelContainer, for the rows currently shown.
|
|
|
|
|
var rows: Dictionary = {}
|
|
|
|
|
var more_row: PanelContainer
|
|
|
|
|
var list_scroll: ScrollContainer
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
var header_ui: TableCardHeader
|
|
|
|
|
var rows_ui: TableCardRows
|
|
|
|
|
var edit_ui: TableCardEditing
|
|
|
|
|
var value_ui: TableCardValue
|
|
|
|
|
## Rules in plain words (read from RulesView at each rebuild).
|
|
|
|
|
var plain := true
|
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 _list_box: VBoxContainer
|
|
|
|
|
var _warn_panel: Control
|
|
|
|
|
var _warn_label: Label
|
|
|
|
|
var _rolling := false
|
|
|
|
|
var _dragging := false
|
|
|
|
|
var _drop_target := false
|
|
|
|
|
var _drag_offset := Vector2.ZERO
|
|
|
|
|
var _style_normal: StyleBoxFlat
|
|
|
|
|
var _style_rolling: StyleBoxFlat
|
|
|
|
|
var _style_dragging: StyleBoxFlat
|
|
|
|
|
var _style_drop: StyleBoxFlat
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
var _style_selected: StyleBoxFlat
|
|
|
|
|
var _selected := false
|
Plain Build display: plain rules on cards, pipes and tray, Why this?, check/collection/inputs visuals
- RulesView (ui/rules_view.gd): plain-or-text helpers over Describe, reading
Main.rules_plain() when present (else StateStore, else plain; --rules=text
for screenshots) and refreshing on Main.rules_view_changed.
- Cards: effect chips, router cases, option sources, show_if, loop rules,
expression dice and variable kinds read in plain words. Build cards drop the
inline effects / show_if / condition / details editors for plain chips;
result text and names stay inline. Row clicks call main.select_result();
the selected row gets a copper bar (set_selected_entry / inspector_selection).
- Check cards: 2D badge, the rule as a sentence, Success / Failure outlets.
Collection cards: live members and "+ Add" (main.select_card). Inputs:
a dashed "Input Tier · starts at 1" box.
- Pipe labels via Describe.pipe, nudged apart and cut to the gap.
- Tray: plain captions (inputs, checks, cases), effect lines from why facts,
and a "Why this?" button opening a WhyPopover; hovers show the same reasons.
- Previews and the choice pop-up read conditions, effects and option sources
in plain words. Style.rules_switch() for the Plain words / Text switch.
- Describe: empty text reads "empty" ("Loot is not empty").
- tests/test_plain_display.gd; option and choice tests pin the Text view
where they check stored text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:30:55 -06:00
|
|
|
## The result picked in the inspector (copper bar), or "".
|
|
|
|
|
var _selected_eid := ""
|
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, p_table: RollTable) -> void:
|
|
|
|
|
main = p_main
|
|
|
|
|
table = p_table
|
|
|
|
|
custom_minimum_size = Vector2(WIDTH, 0)
|
|
|
|
|
mouse_filter = MOUSE_FILTER_PASS
|
|
|
|
|
theme = Style.card_theme()
|
|
|
|
|
position = table.position
|
|
|
|
|
|
|
|
|
|
_style_normal = Style.box(Style.CARD, 10)
|
|
|
|
|
_style_normal.shadow_color = Color(0, 0, 0, 0.32)
|
|
|
|
|
_style_normal.shadow_size = 16
|
|
|
|
|
_style_normal.shadow_offset = Vector2(0, 8)
|
|
|
|
|
_style_rolling = _style_normal.duplicate() as StyleBoxFlat
|
|
|
|
|
Style.bordered(_style_rolling, 3, Style.BRASS)
|
|
|
|
|
_style_rolling.set_expand_margin_all(3)
|
|
|
|
|
_style_rolling.shadow_color = Color(Style.BRASS, 0.45)
|
|
|
|
|
_style_rolling.shadow_size = 26
|
|
|
|
|
_style_rolling.shadow_offset = Vector2.ZERO
|
|
|
|
|
_style_drop = _style_rolling.duplicate() as StyleBoxFlat
|
|
|
|
|
_style_drop.shadow_color = Color(0, 0, 0, 0.32)
|
|
|
|
|
_style_drop.shadow_size = 16
|
|
|
|
|
_style_drop.shadow_offset = Vector2(0, 8)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
_style_selected = _style_normal.duplicate() as StyleBoxFlat
|
|
|
|
|
Style.bordered(_style_selected, 3, Style.COPPER)
|
|
|
|
|
_style_selected.set_expand_margin_all(4)
|
|
|
|
|
_style_selected.shadow_color = Color(Style.COPPER, 0.5)
|
|
|
|
|
_style_selected.shadow_size = 14
|
|
|
|
|
_style_selected.shadow_offset = Vector2.ZERO
|
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
|
|
|
_style_dragging = _style_normal.duplicate() as StyleBoxFlat
|
|
|
|
|
_style_dragging.shadow_color = Color(0, 0, 0, 0.4)
|
|
|
|
|
_style_dragging.shadow_size = 26
|
|
|
|
|
_style_dragging.shadow_offset = Vector2(0, 16)
|
|
|
|
|
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
header_ui = TableCardHeader.new(self)
|
|
|
|
|
rows_ui = TableCardRows.new(self)
|
|
|
|
|
edit_ui = TableCardEditing.new(self)
|
|
|
|
|
value_ui = TableCardValue.new(self)
|
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
|
|
|
minimum_size_changed.connect(func() -> void: _shrink.call_deferred())
|
Plain Build display: plain rules on cards, pipes and tray, Why this?, check/collection/inputs visuals
- RulesView (ui/rules_view.gd): plain-or-text helpers over Describe, reading
Main.rules_plain() when present (else StateStore, else plain; --rules=text
for screenshots) and refreshing on Main.rules_view_changed.
- Cards: effect chips, router cases, option sources, show_if, loop rules,
expression dice and variable kinds read in plain words. Build cards drop the
inline effects / show_if / condition / details editors for plain chips;
result text and names stay inline. Row clicks call main.select_result();
the selected row gets a copper bar (set_selected_entry / inspector_selection).
- Check cards: 2D badge, the rule as a sentence, Success / Failure outlets.
Collection cards: live members and "+ Add" (main.select_card). Inputs:
a dashed "Input Tier · starts at 1" box.
- Pipe labels via Describe.pipe, nudged apart and cut to the gap.
- Tray: plain captions (inputs, checks, cases), effect lines from why facts,
and a "Why this?" button opening a WhyPopover; hovers show the same reasons.
- Previews and the choice pop-up read conditions, effects and option sources
in plain words. Style.rules_switch() for the Plain words / Text switch.
- Describe: empty text reads "empty" ("Loot is not empty").
- tests/test_plain_display.gd; option and choice tests pin the Text view
where they check stored text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:30:55 -06:00
|
|
|
RulesView.watch(main, _on_rules_view_changed)
|
|
|
|
|
rebuild()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_rules_view_changed(_v: Variant = null) -> void:
|
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
|
|
|
rebuild()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func rebuild() -> void:
|
|
|
|
|
for c in get_children():
|
|
|
|
|
remove_child(c)
|
|
|
|
|
c.queue_free()
|
|
|
|
|
rows.clear()
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
rows_ui.clear()
|
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
|
|
|
more_row = null
|
|
|
|
|
list_scroll = null
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
header_ui.clear()
|
|
|
|
|
value_ui.clear()
|
|
|
|
|
plain = RulesView.plain(main)
|
Plain Build display: plain rules on cards, pipes and tray, Why this?, check/collection/inputs visuals
- RulesView (ui/rules_view.gd): plain-or-text helpers over Describe, reading
Main.rules_plain() when present (else StateStore, else plain; --rules=text
for screenshots) and refreshing on Main.rules_view_changed.
- Cards: effect chips, router cases, option sources, show_if, loop rules,
expression dice and variable kinds read in plain words. Build cards drop the
inline effects / show_if / condition / details editors for plain chips;
result text and names stay inline. Row clicks call main.select_result();
the selected row gets a copper bar (set_selected_entry / inspector_selection).
- Check cards: 2D badge, the rule as a sentence, Success / Failure outlets.
Collection cards: live members and "+ Add" (main.select_card). Inputs:
a dashed "Input Tier · starts at 1" box.
- Pipe labels via Describe.pipe, nudged apart and cut to the gap.
- Tray: plain captions (inputs, checks, cases), effect lines from why facts,
and a "Why this?" button opening a WhyPopover; hovers show the same reasons.
- Previews and the choice pop-up read conditions, effects and option sources
in plain words. Style.rules_switch() for the Plain words / Text switch.
- Describe: empty text reads "empty" ("Loot is not empty").
- tests/test_plain_display.gd; option and choice tests pin the Text view
where they check stored text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:30:55 -06:00
|
|
|
if main.has_method("inspector_selection"):
|
|
|
|
|
var sel: Variant = main.call("inspector_selection")
|
|
|
|
|
_selected_eid = ""
|
2026-11-08 21:36:29 -06:00
|
|
|
# The inspector reports {kind, tid, eid}; older callers used {table_id, entry_id}.
|
|
|
|
|
if sel is Dictionary:
|
|
|
|
|
var d := sel as Dictionary
|
|
|
|
|
var tid := str(d.get("tid", d.get("table_id", "")))
|
|
|
|
|
if tid == table.id and str(d.get("kind", "result")) == "result":
|
|
|
|
|
_selected_eid = str(d.get("eid", d.get("entry_id", "")))
|
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 build := main.mode == Main.Mode.BUILD
|
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
|
|
|
custom_minimum_size = Vector2(card_width(), 0)
|
|
|
|
|
_shrink.call_deferred()
|
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 ranged := table.is_ranged()
|
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 collapsed := is_collapsed()
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
var col := vbox(0)
|
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
|
|
|
add_child(col)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
col.add_child(header_ui.make(build, ranged))
|
Plain Build display: plain rules on cards, pipes and tray, Why this?, check/collection/inputs visuals
- RulesView (ui/rules_view.gd): plain-or-text helpers over Describe, reading
Main.rules_plain() when present (else StateStore, else plain; --rules=text
for screenshots) and refreshing on Main.rules_view_changed.
- Cards: effect chips, router cases, option sources, show_if, loop rules,
expression dice and variable kinds read in plain words. Build cards drop the
inline effects / show_if / condition / details editors for plain chips;
result text and names stay inline. Row clicks call main.select_result();
the selected row gets a copper bar (set_selected_entry / inspector_selection).
- Check cards: 2D badge, the rule as a sentence, Success / Failure outlets.
Collection cards: live members and "+ Add" (main.select_card). Inputs:
a dashed "Input Tier · starts at 1" box.
- Pipe labels via Describe.pipe, nudged apart and cut to the gap.
- Tray: plain captions (inputs, checks, cases), effect lines from why facts,
and a "Why this?" button opening a WhyPopover; hovers show the same reasons.
- Previews and the choice pop-up read conditions, effects and option sources
in plain words. Style.rules_switch() for the Plain words / Text switch.
- Describe: empty text reads "empty" ("Loot is not empty").
- tests/test_plain_display.gd; option and choice tests pin the Text view
where they check stored text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:30:55 -06:00
|
|
|
if not table.inputs.is_empty() and table.kind != RollTable.KIND_VARIABLE:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
col.add_child(header_ui.make_inputs_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
|
|
|
|
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 table.kind == RollTable.KIND_VARIABLE:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
col.add_child(value_ui.make_collection_body(build) if table.is_collection() else value_ui.make_variable_body(build))
|
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
|
|
|
_warn_panel = _make_warning()
|
|
|
|
|
col.add_child(_warn_panel)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
update_warning()
|
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 build:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
col.add_child(edit_ui.make_footer(ranged))
|
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
|
|
|
_apply_style()
|
|
|
|
|
refresh_live()
|
|
|
|
|
return
|
|
|
|
|
|
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 pad := MarginContainer.new()
|
|
|
|
|
pad.mouse_filter = MOUSE_FILTER_PASS
|
|
|
|
|
pad.add_theme_constant_override("margin_top", 6)
|
|
|
|
|
pad.add_theme_constant_override("margin_bottom", 8)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
_list_box = vbox(0)
|
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
|
|
|
pad.add_child(_list_box)
|
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 not collapsed and table.entries.size() > LONG_LIST:
|
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
|
|
|
list_scroll = ScrollContainer.new()
|
|
|
|
|
list_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
|
|
|
|
|
list_scroll.custom_minimum_size = Vector2(0, LIST_HEIGHT)
|
|
|
|
|
list_scroll.mouse_filter = MOUSE_FILTER_PASS
|
|
|
|
|
_skin_scrollbar(list_scroll.get_v_scroll_bar())
|
|
|
|
|
pad.size_flags_horizontal = SIZE_EXPAND_FILL
|
|
|
|
|
list_scroll.add_child(pad)
|
|
|
|
|
col.add_child(list_scroll)
|
|
|
|
|
else:
|
|
|
|
|
col.add_child(pad)
|
|
|
|
|
|
|
|
|
|
var numw := _num_width(build, ranged)
|
|
|
|
|
for i in table.entries.size():
|
|
|
|
|
var e := table.entries[i]
|
|
|
|
|
var lit := main.is_entry_lit(table.id, e.id)
|
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 collapsed and not lit:
|
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
|
|
|
continue
|
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 table.kind == RollTable.KIND_SHEET:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
_list_box.add_child(rows_ui.make_sheet_row(e, build))
|
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
|
|
|
elif table.kind == RollTable.KIND_ROUTER and build:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
_list_box.add_child(edit_ui.make_case_row(e, i, numw))
|
Plain Build display: plain rules on cards, pipes and tray, Why this?, check/collection/inputs visuals
- RulesView (ui/rules_view.gd): plain-or-text helpers over Describe, reading
Main.rules_plain() when present (else StateStore, else plain; --rules=text
for screenshots) and refreshing on Main.rules_view_changed.
- Cards: effect chips, router cases, option sources, show_if, loop rules,
expression dice and variable kinds read in plain words. Build cards drop the
inline effects / show_if / condition / details editors for plain chips;
result text and names stay inline. Row clicks call main.select_result();
the selected row gets a copper bar (set_selected_entry / inspector_selection).
- Check cards: 2D badge, the rule as a sentence, Success / Failure outlets.
Collection cards: live members and "+ Add" (main.select_card). Inputs:
a dashed "Input Tier · starts at 1" box.
- Pipe labels via Describe.pipe, nudged apart and cut to the gap.
- Tray: plain captions (inputs, checks, cases), effect lines from why facts,
and a "Why this?" button opening a WhyPopover; hovers show the same reasons.
- Previews and the choice pop-up read conditions, effects and option sources
in plain words. Style.rules_switch() for the Plain words / Text switch.
- Describe: empty text reads "empty" ("Loot is not empty").
- tests/test_plain_display.gd; option and choice tests pin the Text view
where they check stored text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:30:55 -06:00
|
|
|
elif table.kind == RollTable.KIND_CHECK:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
_list_box.add_child(rows_ui.make_check_row(e, i, build, numw))
|
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:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
_list_box.add_child(rows_ui.make_row(e, i, build, ranged, numw))
|
|
|
|
|
rows_ui.set_row_state(e.id, TableCardRows.RowState.LIT if lit else TableCardRows.RowState.NORMAL)
|
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 collapsed:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
more_row = rows_ui.make_more_row(numw)
|
|
|
|
|
_list_box.add_child(more_row)
|
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
|
|
|
|
|
|
|
|
_warn_panel = _make_warning()
|
|
|
|
|
col.add_child(_warn_panel)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
update_warning()
|
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 build:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
col.add_child(edit_ui.make_footer(ranged))
|
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
|
|
|
_apply_style()
|
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
|
|
|
refresh_live()
|
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 list_scroll != null:
|
|
|
|
|
for eid in rows:
|
|
|
|
|
if main.is_entry_lit(table.id, eid):
|
|
|
|
|
_reveal_when_laid_out.call_deferred(eid)
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
## Variable and sheet cards always show everything; other cards collapse.
|
|
|
|
|
func is_collapsed() -> bool:
|
|
|
|
|
return table.collapsed and can_collapse()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func can_collapse() -> bool:
|
|
|
|
|
return table.kind != RollTable.KIND_VARIABLE and table.kind != RollTable.KIND_SHEET
|
|
|
|
|
|
|
|
|
|
|
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 _reveal_when_laid_out(eid: String) -> void:
|
|
|
|
|
await get_tree().process_frame
|
|
|
|
|
if is_instance_valid(list_scroll):
|
|
|
|
|
reveal(eid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- Building blocks ----------
|
|
|
|
|
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
static func vbox(sep: int) -> 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 v := VBoxContainer.new()
|
|
|
|
|
v.add_theme_constant_override("separation", sep)
|
|
|
|
|
v.mouse_filter = MOUSE_FILTER_PASS
|
|
|
|
|
return v
|
|
|
|
|
|
|
|
|
|
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
static func hbox(sep: int) -> HBoxContainer:
|
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 h := HBoxContainer.new()
|
|
|
|
|
h.add_theme_constant_override("separation", sep)
|
|
|
|
|
h.mouse_filter = MOUSE_FILTER_PASS
|
|
|
|
|
return h
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _num_width(build: bool, ranged: bool) -> float:
|
|
|
|
|
var wide := table.die_size() >= 100
|
|
|
|
|
if build and ranged:
|
|
|
|
|
return 90.0
|
|
|
|
|
if ranged:
|
|
|
|
|
return 52.0 if wide else 40.0
|
|
|
|
|
return 24.0 if wide else 22.0
|
|
|
|
|
|
|
|
|
|
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
# Card texts now live in TableCardText; other files still call these here.
|
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
|
|
|
static func case_label(e: TableEntry) -> String:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
return TableCardText.case_label(e)
|
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
|
|
|
|
|
|
|
|
|
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
|
|
|
static func loop_rule(t: RollTable) -> String:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
return TableCardText.loop_rule(t)
|
Plain Build display: plain rules on cards, pipes and tray, Why this?, check/collection/inputs visuals
- RulesView (ui/rules_view.gd): plain-or-text helpers over Describe, reading
Main.rules_plain() when present (else StateStore, else plain; --rules=text
for screenshots) and refreshing on Main.rules_view_changed.
- Cards: effect chips, router cases, option sources, show_if, loop rules,
expression dice and variable kinds read in plain words. Build cards drop the
inline effects / show_if / condition / details editors for plain chips;
result text and names stay inline. Row clicks call main.select_result();
the selected row gets a copper bar (set_selected_entry / inspector_selection).
- Check cards: 2D badge, the rule as a sentence, Success / Failure outlets.
Collection cards: live members and "+ Add" (main.select_card). Inputs:
a dashed "Input Tier · starts at 1" box.
- Pipe labels via Describe.pipe, nudged apart and cut to the gap.
- Tray: plain captions (inputs, checks, cases), effect lines from why facts,
and a "Why this?" button opening a WhyPopover; hovers show the same reasons.
- Previews and the choice pop-up read conditions, effects and option sources
in plain words. Style.rules_switch() for the Plain words / Text switch.
- Describe: empty text reads "empty" ("Loot is not empty").
- tests/test_plain_display.gd; option and choice tests pin the Text view
where they check stored text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:30:55 -06:00
|
|
|
|
|
|
|
|
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
static func options_line(t: RollTable) -> String:
|
|
|
|
|
return TableCardText.options_line(t)
|
Plain Build display: plain rules on cards, pipes and tray, Why this?, check/collection/inputs visuals
- RulesView (ui/rules_view.gd): plain-or-text helpers over Describe, reading
Main.rules_plain() when present (else StateStore, else plain; --rules=text
for screenshots) and refreshing on Main.rules_view_changed.
- Cards: effect chips, router cases, option sources, show_if, loop rules,
expression dice and variable kinds read in plain words. Build cards drop the
inline effects / show_if / condition / details editors for plain chips;
result text and names stay inline. Row clicks call main.select_result();
the selected row gets a copper bar (set_selected_entry / inspector_selection).
- Check cards: 2D badge, the rule as a sentence, Success / Failure outlets.
Collection cards: live members and "+ Add" (main.select_card). Inputs:
a dashed "Input Tier · starts at 1" box.
- Pipe labels via Describe.pipe, nudged apart and cut to the gap.
- Tray: plain captions (inputs, checks, cases), effect lines from why facts,
and a "Why this?" button opening a WhyPopover; hovers show the same reasons.
- Previews and the choice pop-up read conditions, effects and option sources
in plain words. Style.rules_switch() for the Plain words / Text switch.
- Describe: empty text reads "empty" ("Loot is not empty").
- tests/test_plain_display.gd; option and choice tests pin the Text view
where they check stored text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:30:55 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
static func check_outlet_name(index: int) -> String:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
return TableCardText.check_outlet_name(index)
|
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 _make_warning() -> Control:
|
|
|
|
|
var wrap := MarginContainer.new()
|
|
|
|
|
wrap.mouse_filter = MOUSE_FILTER_PASS
|
|
|
|
|
wrap.add_theme_constant_override("margin_left", 12)
|
|
|
|
|
wrap.add_theme_constant_override("margin_right", 12)
|
|
|
|
|
wrap.add_theme_constant_override("margin_bottom", 10)
|
|
|
|
|
var panel := PanelContainer.new()
|
|
|
|
|
panel.add_theme_stylebox_override("panel", Style.box(Style.WARN_BG, 6, [9, 6, 9, 6]))
|
|
|
|
|
panel.mouse_filter = MOUSE_FILTER_PASS
|
|
|
|
|
_warn_label = Style.make_label("", Style.body(true), 13, Style.WARN_INK)
|
|
|
|
|
_warn_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
panel.add_child(_warn_label)
|
|
|
|
|
wrap.add_child(panel)
|
|
|
|
|
return wrap
|
|
|
|
|
|
|
|
|
|
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
func update_warning() -> void:
|
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 problems := table.range_problems()
|
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
|
|
|
var lines := PackedStringArray()
|
|
|
|
|
for item: Dictionary in Roller.lint_router(table):
|
|
|
|
|
lines.append(str(item["message"]))
|
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
|
|
|
for item: Dictionary in Roller.lint_options(table):
|
|
|
|
|
lines.append(str(item["message"]))
|
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
|
|
|
if not lines.is_empty():
|
|
|
|
|
problems = ("%s\n" % problems if problems != "" else "") + "\n".join(lines)
|
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
|
|
|
_warn_label.text = problems
|
|
|
|
|
_warn_panel.visible = problems != ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _skin_scrollbar(bar: VScrollBar) -> void:
|
|
|
|
|
var track := Style.box(Color(0, 0, 0, 0), 3, [3, 0, 3, 0])
|
|
|
|
|
var grab := Style.box(Color(0, 0, 0, 0.22), 3, [3, 0, 3, 0])
|
|
|
|
|
var grab_hi := Style.box(Color(0, 0, 0, 0.35), 3, [3, 0, 3, 0])
|
|
|
|
|
bar.add_theme_stylebox_override("scroll", track)
|
|
|
|
|
bar.add_theme_stylebox_override("scroll_focus", track)
|
|
|
|
|
bar.add_theme_stylebox_override("grabber", grab)
|
|
|
|
|
bar.add_theme_stylebox_override("grabber_highlight", grab_hi)
|
|
|
|
|
bar.add_theme_stylebox_override("grabber_pressed", grab_hi)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- State ----------
|
|
|
|
|
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
## Selects a result for the inspector: main.select_result(table id, entry id)
|
|
|
|
|
## when Main has it, and the copper bar on this row (cleared on other cards).
|
|
|
|
|
func select_entry(eid: String) -> void:
|
|
|
|
|
if main.mode != Main.Mode.BUILD:
|
|
|
|
|
return
|
|
|
|
|
if main.has_method("select_result"):
|
|
|
|
|
main.call("select_result", table.id, eid)
|
|
|
|
|
for c: Variant in main.cards.values():
|
|
|
|
|
if c is TableCard and c != self:
|
|
|
|
|
(c as TableCard).set_selected_entry("")
|
|
|
|
|
set_selected_entry(eid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Shows the copper selection bar on one result row ("" for none). The
|
|
|
|
|
## inspector may call this on every card when its selection changes.
|
|
|
|
|
func set_selected_entry(eid: String) -> void:
|
|
|
|
|
if _selected_eid == eid:
|
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
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
var old := _selected_eid
|
|
|
|
|
_selected_eid = eid
|
|
|
|
|
for k: String in [old, eid]:
|
|
|
|
|
if k != "" and rows.has(k):
|
|
|
|
|
rows_ui.restate(k)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func selected_entry() -> String:
|
|
|
|
|
return _selected_eid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Refreshes the cards-left count of a card-mode table.
|
|
|
|
|
func update_deck() -> void:
|
|
|
|
|
header_ui.update_deck()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Re-renders the live parts (a variable's value, a sheet, a choice's
|
|
|
|
|
## question) from the current variables. Only touches labels whose text
|
|
|
|
|
## changed. Main calls it after rolls and edits, never per frame.
|
|
|
|
|
func refresh_live() -> void:
|
|
|
|
|
value_ui.refresh()
|
|
|
|
|
rows_ui.refresh_sheet()
|
|
|
|
|
header_ui.refresh_live()
|
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 _apply_style() -> void:
|
|
|
|
|
var s := _style_normal
|
|
|
|
|
if _drop_target:
|
|
|
|
|
s = _style_drop
|
|
|
|
|
elif _rolling:
|
|
|
|
|
s = _style_rolling
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
elif _selected:
|
|
|
|
|
s = _style_selected
|
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
|
|
|
elif _dragging:
|
|
|
|
|
s = _style_dragging
|
|
|
|
|
add_theme_stylebox_override("panel", s)
|
|
|
|
|
|
|
|
|
|
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
## Build-mode selection (Main.selection): a copper ring around the card.
|
|
|
|
|
func set_selected(on: bool) -> void:
|
|
|
|
|
if _selected != on:
|
|
|
|
|
_selected = on
|
|
|
|
|
_apply_style()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func is_selected() -> bool:
|
|
|
|
|
return _selected
|
|
|
|
|
|
|
|
|
|
|
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 _shrink() -> void:
|
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
|
|
|
size = Vector2(card_width(), 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func card_width() -> float:
|
|
|
|
|
return BUILD_WIDTH if main.mode == Main.Mode.BUILD else WIDTH
|
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 set_rolling(on: bool) -> void:
|
|
|
|
|
_rolling = on
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
if is_instance_valid(header_ui.die_icon):
|
|
|
|
|
header_ui.die_icon.spinning = on
|
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
|
|
|
_apply_style()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func set_drop_target(on: bool) -> void:
|
|
|
|
|
_drop_target = on
|
|
|
|
|
_apply_style()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func flick_random() -> void:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
rows_ui.flick_random()
|
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 clear_flick() -> void:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
rows_ui.clear_flick()
|
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 set_more_text(text: String) -> void:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
if rows_ui.more_label:
|
|
|
|
|
rows_ui.more_label.text = text
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
## Updates highlights after a roll. Collapsed cards rebuild so the rolled result shows.
|
|
|
|
|
func refresh_lit() -> void:
|
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
|
|
|
update_deck()
|
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 is_collapsed():
|
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 want: Array = []
|
|
|
|
|
for e in table.entries:
|
|
|
|
|
if main.is_entry_lit(table.id, e.id):
|
|
|
|
|
want.append(e.id)
|
|
|
|
|
if want != rows.keys():
|
|
|
|
|
rebuild()
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
elif rows_ui.more_label:
|
|
|
|
|
rows_ui.more_label.text = rows_ui.more_text()
|
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
|
|
|
|
|
for eid in rows:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
rows_ui.update_row_text(eid)
|
|
|
|
|
rows_ui.restate(eid)
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
## Scrolls a long list so the given result sits in the middle.
|
|
|
|
|
func reveal(eid: String) -> void:
|
|
|
|
|
if list_scroll == null or not rows.has(eid):
|
|
|
|
|
return
|
|
|
|
|
var row: Control = rows[eid]
|
|
|
|
|
list_scroll.scroll_vertical = int(row.position.y + 6.0 - list_scroll.size.y / 2.0 + row.size.y / 2.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func hidden_has_pipes() -> bool:
|
|
|
|
|
for e in table.entries:
|
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 not rows.has(e.id) and (not e.pipes.is_empty() or not main.ref_targets_for(e).is_empty()):
|
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 true
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- Geometry (world coordinates) ----------
|
|
|
|
|
|
|
|
|
|
func inlet_point() -> Vector2:
|
|
|
|
|
return Vector2(position.x, position.y + INLET_Y)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Where a pipe leaves this card for an entry: its row, or the "more" row when the
|
|
|
|
|
## entry is hidden in a collapsed card. Rows scrolled out of a long list clamp to
|
|
|
|
|
## its edge. Returns {} if there's nowhere to anchor.
|
|
|
|
|
func anchor_for(eid: String) -> Dictionary:
|
|
|
|
|
var row: Control = rows.get(eid, more_row)
|
|
|
|
|
if row == null or not row.is_inside_tree():
|
|
|
|
|
return {}
|
|
|
|
|
var to_world := main.board.world.get_global_transform().affine_inverse()
|
|
|
|
|
var r := row.get_global_rect()
|
|
|
|
|
var y := (to_world * (r.position + Vector2(0, r.size.y / 2.0))).y
|
|
|
|
|
var shown := true
|
|
|
|
|
if list_scroll != null and rows.has(eid):
|
|
|
|
|
var sr := list_scroll.get_global_rect()
|
|
|
|
|
var top := (to_world * sr.position).y + 14.0
|
|
|
|
|
var bottom := (to_world * sr.end).y - 14.0
|
|
|
|
|
shown = y >= top - 4.0 and y <= bottom + 4.0
|
|
|
|
|
y = clampf(y, top, bottom)
|
|
|
|
|
return {"pos": Vector2(position.x + size.x, y), "visible": shown}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- Input ----------
|
|
|
|
|
|
|
|
|
|
func _gui_input(ev: InputEvent) -> void:
|
|
|
|
|
# Clicks on the card body shouldn't pan the board; the wheel still passes through.
|
|
|
|
|
var mb := ev as InputEventMouseButton
|
|
|
|
|
if mb and mb.button_index == MOUSE_BUTTON_LEFT:
|
|
|
|
|
accept_event()
|
|
|
|
|
|
|
|
|
|
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
## Dragging the header moves the card (and, in Build, every selected card).
|
|
|
|
|
## In Build, Ctrl- or Shift-click adds the card to the selection or takes it
|
|
|
|
|
## out; dropping a card into a group frame adds it to that group (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
|
|
|
func _on_header_input(ev: InputEvent, header: Control) -> void:
|
|
|
|
|
var mb := ev as InputEventMouseButton
|
|
|
|
|
if mb and mb.button_index == MOUSE_BUTTON_LEFT:
|
|
|
|
|
if mb.pressed:
|
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
|
|
|
main.details().hide_for()
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
var build := main.mode == Main.Mode.BUILD
|
|
|
|
|
if build and (mb.ctrl_pressed or mb.shift_pressed or mb.meta_pressed):
|
|
|
|
|
main.toggle_selected(table.id)
|
|
|
|
|
header.accept_event()
|
|
|
|
|
return
|
|
|
|
|
if build and not main.is_selected(table.id):
|
|
|
|
|
main.clear_selection()
|
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
|
|
|
_dragging = true
|
|
|
|
|
_drag_offset = main.board.world_mouse() - position
|
|
|
|
|
get_parent().move_child(self, -1)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
main.begin_card_drag(self)
|
|
|
|
|
elif _dragging:
|
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
|
|
|
_dragging = false
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
main.end_card_drag(self)
|
|
|
|
|
else:
|
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
|
|
|
main.mark_dirty()
|
|
|
|
|
_apply_style()
|
|
|
|
|
header.accept_event()
|
|
|
|
|
return
|
|
|
|
|
var mm := ev as InputEventMouseMotion
|
|
|
|
|
if mm and _dragging:
|
|
|
|
|
var p := main.board.world_mouse() - _drag_offset
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
main.drag_card(self, Vector2(maxf(10.0, roundf(p.x)), maxf(10.0, roundf(p.y))))
|
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
|
|
|
header.accept_event()
|