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 Main
|
|
|
|
|
extends Control
|
|
|
|
|
## The app window: top bar, felt board and result tray. Owns the board data,
|
Undo and redo for every Build edit
EditHistory (ui/edit_history.gd) keeps an undo and a redo stack of
whole-board snapshots per collection. Each table and group is its own
JSON string, shared with the previous snapshot when unchanged, so a step
costs about the size of the cards it changed. Collapsed flags are kept
apart: collapsing isn't a step and undo leaves it as it is. Labels come
from diffing the snapshots ("Delete table Loot", "Add pipe Loot → Gems",
"Move 3 cards", "Group Careers"), or from the caller.
Main.mark_dirty records steps: typing commits when it pauses (0.8 s) and
merges until focus moves, other edits commit at the end of the frame (a
drag is one step), and quick edits to the same card or pipe merge.
Actions in main.gd bracket their changes with _begin_edit/_end_edit.
Undo patches only the changed tables and groups in place and rebuilds
their cards, keeping view, mode, search and lit results, then flashes
what changed. Ctrl+Z, Ctrl+Shift+Z / Ctrl+Y outside text fields (Play
too), Undo/Redo buttons with step tooltips in the Build bar, and the
toast's Undo now goes through the history.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 19:00:47 -06:00
|
|
|
## the Play/Build mode, roll animation, and editing actions with undo and
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
## redo (EditHistory, one per collection; see ui/main_history.gd).
|
|
|
|
|
##
|
|
|
|
|
## Main is a shell: the shared state, start-up and the cards. Each area lives
|
|
|
|
|
## in a helper (ui/main_*.gd) holding its own state; the methods other files
|
|
|
|
|
## call stay here as one-line delegators (bottom of this file).
|
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
|
|
|
|
|
|
|
|
enum Mode { PLAY, BUILD }
|
|
|
|
|
|
2026-11-08 21:24:25 -06:00
|
|
|
## The rules view changed ("plain" or "text"; see set_rules_view).
|
|
|
|
|
signal rules_view_changed(view: String)
|
|
|
|
|
|
2026-11-14 14:09:01 -06:00
|
|
|
## Earlier rolls kept in the tray (a batch of rolls fills several).
|
|
|
|
|
const HISTORY_SIZE := 30
|
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 SAVE_DELAY := 0.6
|
|
|
|
|
const HINTS := {
|
2026-11-08 12:53:39 -06:00
|
|
|
Mode.PLAY: "Click a die to roll. Shift-click skips straight to the result.",
|
2026-11-10 18:24:23 -06:00
|
|
|
Mode.BUILD: "Click a card, a result or a thread to edit it in the inspector. Drag from a ● to another card to lay a thread.",
|
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 data: TowerBoard
|
2026-11-08 12:11:26 -06:00
|
|
|
var library: LibraryStore
|
|
|
|
|
var state: StateStore
|
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 mode: Mode = Mode.PLAY
|
|
|
|
|
var cards: Dictionary = {} # table id -> TableCard
|
|
|
|
|
var lit_entries: Dictionary = {} # "tid:eid" -> true
|
|
|
|
|
var lit_pipes: Dictionary = {} # "tid:eid>to" -> true
|
|
|
|
|
var current: Dictionary = {}
|
|
|
|
|
var history: Array = []
|
|
|
|
|
var rng := RandomNumberGenerator.new()
|
Big-board navigation: search, focus_table, minimap, pack, lazy cards
- Search (top bar button and Ctrl+F): a card-styled pop-over with live
results from names, result text, details, prompts, variables and group
names (BBCode stripped, case and accents ignored, exact names first).
Up/Down, Enter or click jump to a result, Esc closes.
- Main.focus_table(table_id, entry_id): opens a collapsed group (toast),
expands the card for an entry, glides to it at a readable zoom, scrolls
the long list and flashes rings around the card and the row.
- Minimap (Map toggle beside Fit, M key): tinted blocks, lit cards in
brass, the view rect; click or drag to pan. Off by default in Play, on in
Build, remembered per mode. Redraws only on change.
- Zoom goes down to 0.08 and Fit uses it; far out, cards draw as plain
cards and group names show large.
- Build > Arrange > Pack collapsed groups closes the gaps collapsed blocks
leave, in reading order, with undo. Expanding a group whose frame would
cover its neighbours pushes them right/down to clear it, with undo.
- Performance: cards in collapsed groups aren't built until expanded; the
pipe, port and card layers redraw only when the board's geometry
changes; unlit pipes go in per-pipe canvas items so off-screen ones are
culled; off-screen cards aren't rendered. 792-card board: open 5.0 s ->
0.38 s, idle frame 36 ms -> 0.7 ms (all groups expanded: 313 ms -> 9 ms).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:16:32 -06:00
|
|
|
## Bumped by mark_dirty and _refresh_lit; BoardView redraws its layers when it changes.
|
|
|
|
|
var view_rev := 0
|
|
|
|
|
## Bumped by mark_dirty: the search index is rebuilt when it changes.
|
|
|
|
|
var edit_rev := 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
|
|
|
|
|
|
|
|
var board: BoardView
|
|
|
|
|
var tray: ResultTray
|
2026-11-08 21:24:25 -06:00
|
|
|
## The Build-mode inspector docked right of the board (ui/inspector.gd).
|
|
|
|
|
var inspector: Inspector
|
2026-11-10 18:30:13 -06:00
|
|
|
## Table ids selected in Build mode (Ctrl/Shift-click, or a drag box on empty space).
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
var selection: Dictionary = {}
|
2026-11-10 18:30:13 -06:00
|
|
|
## Groups in the Build selection (MainSelection).
|
|
|
|
|
var selecting: MainSelection
|
2026-11-10 18:50:32 -06:00
|
|
|
## The List view panel (left dock).
|
|
|
|
|
var list_view: ListView
|
2026-11-10 18:58:33 -06:00
|
|
|
## The phone layout, when it is on (MobileLayout.wanted).
|
|
|
|
|
var mobile: MobileLayout
|
2026-11-10 19:02:46 -06:00
|
|
|
## The Book panel (reusable results).
|
|
|
|
|
var book: BookPanel
|
Help: topics for every new feature, a cheat sheet, and Try a demo spreads
Twelve new Help topics (menus, selecting and resizing, nested groups,
themes, List view, the Book, rolling more than once, pausing, costs,
one table adjusting another, sheets and saving, pictures, phones), and a
Keyboard shortcuts topic split into keys, mouse and touch. Topics with
[demo]key[/demo] get a 'Try a demo spread' link: DemoSpreads builds a
small example, DemoMode shows it unsaved and unlisted with Keep a copy
and Back to my spread. --demo=KEY opens one from the command line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:24:57 -06:00
|
|
|
## Help's demo spreads (shown unsaved).
|
|
|
|
|
var demo: DemoMode
|
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 _save_timer: Timer
|
|
|
|
|
var _saving_enabled := true
|
2026-11-14 13:28:31 -06:00
|
|
|
## When there's no `state` (--sample), the rules view lives here (docs/PLAIN.md §6).
|
|
|
|
|
var _rules_view_mem := "plain"
|
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
|
|
|
|
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
|
|
|
# Local state for the current collection (see load_local_state). Kept in memory
|
|
|
|
|
# and written to `state` when there is one (saving disabled: memory only).
|
|
|
|
|
var decks: Dictionary = {} # table id -> DeckState
|
|
|
|
|
var persistent_vars: Dictionary = {} # name without "@" -> {"value", "source"}
|
|
|
|
|
var lit_texts: Dictionary = {} # "tid:eid" -> expanded BBCode from the last roll
|
UI for cards with columns: header and cells, inspector Columns section, help
- TableCardColumns: the column-name header, each row's cells after its text
(Play: wrapping text; Build: a field per cell, edited inline), cards widen
per column, and in "each" mode the cell each column landed on is lit
(Main.lit_columns, from the rolled node's columns).
- InspectorColumns: Add columns, add/rename/move/remove (cells kept in step),
one roll vs each column, Save as (value picker) and Only if (condition
builder); the result inspector gets a field per extra column.
- Help: a Columns topic after Ranged tables and dice.
- tests/test_ui_columns.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 21:24:35 -06:00
|
|
|
var lit_columns: Dictionary = {} # "tid:eid" -> the rolled node's "columns" (TableCardColumns)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
var _details_popup: DetailsPopup
|
Logic cards engine: expressions, effects, choice/loop/variable/sheet cards, coroutine roller
- Expr: @vars, chain vars, dice tokens, dm/has/count, lone = as ==, errors as values, parse cache
- Effects: = += -= *= /= and reset (with prefix), number vs list semantics, logs, validation
- RollTable kinds and per-kind fields with factories; expression dice with end clamping
- TableEntry effects and expression pipe counts; JSON round trip through JsonIO
- TextExpander: {@prefix_*}, {= expr}, number display, expand_async and live render()
- Roller: coroutine with an explicit work stack, prompts for choice cards, loops,
10,000-action limit, partial tree on ctx.root, iterative flatten/collect_lit
- Variables keep numbers as numbers through StateStore
- Main: awaits the roll with a default (headless) prompt hook, iterative playback,
long chains show at once
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:38:42 -06:00
|
|
|
## Choice cards: func(request: Dictionary) -> Variant, awaited by the roller
|
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
|
|
|
## (docs/LOGIC.md §8). It opens the choice pop-up (_ask_player); tests swap in
|
|
|
|
|
## a script.
|
|
|
|
|
var prompt_hook: Callable = Callable()
|
Logic cards engine: expressions, effects, choice/loop/variable/sheet cards, coroutine roller
- Expr: @vars, chain vars, dice tokens, dm/has/count, lone = as ==, errors as values, parse cache
- Effects: = += -= *= /= and reset (with prefix), number vs list semantics, logs, validation
- RollTable kinds and per-kind fields with factories; expression dice with end clamping
- TableEntry effects and expression pipe counts; JSON round trip through JsonIO
- TextExpander: {@prefix_*}, {= expr}, number display, expand_async and live render()
- Roller: coroutine with an explicit work stack, prompts for choice cards, loops,
10,000-action limit, partial tree on ctx.root, iterative flatten/collect_lit
- Variables keep numbers as numbers through StateStore
- Main: awaits the roll with a default (headless) prompt hook, iterative playback,
long chains show at once
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:38:42 -06:00
|
|
|
## The context of the roll in progress, or null; its root is the tree so far
|
|
|
|
|
## (Roller.progress()).
|
|
|
|
|
var rolling_ctx: RollContext = null
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
|
|
|
|
|
# The helpers, one per area.
|
|
|
|
|
var top_bar: MainTopBar
|
|
|
|
|
var editing: MainEditing
|
|
|
|
|
var grouping: MainGroups
|
|
|
|
|
var templating: MainTemplates
|
|
|
|
|
var rolling: MainRolling
|
|
|
|
|
var collections: MainCollections
|
|
|
|
|
var local_state: MainState
|
|
|
|
|
var nav: MainNavigation
|
|
|
|
|
var undo_redo: MainHistory
|
|
|
|
|
var inspecting: MainInspectorLink
|
Theme tiers 1-2: theme folders, mascot recolour, background scene and tile, frame sets, picture threads, sounds; nine new built-in themes
- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame;
ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt
recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays
roll / card turn / thread / click / ambient with View > Sound levels.
- Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal:
generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs).
- Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:05:40 -06:00
|
|
|
## The theme's sounds (made in _ready, once the theme is applied).
|
|
|
|
|
var sound: SoundBoard
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
var cli: MainCli
|
2026-11-10 19:45:37 -06:00
|
|
|
var layout: MainLayout
|
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
|
|
|
|
|
|
|
|
func _init() -> void:
|
2026-11-10 19:45:37 -06:00
|
|
|
layout = MainLayout.new(self)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
top_bar = MainTopBar.new(self)
|
|
|
|
|
editing = MainEditing.new(self)
|
|
|
|
|
grouping = MainGroups.new(self)
|
|
|
|
|
templating = MainTemplates.new(self)
|
|
|
|
|
rolling = MainRolling.new(self)
|
|
|
|
|
collections = MainCollections.new(self)
|
|
|
|
|
local_state = MainState.new(self)
|
|
|
|
|
nav = MainNavigation.new(self)
|
|
|
|
|
undo_redo = MainHistory.new(self)
|
|
|
|
|
inspecting = MainInspectorLink.new(self)
|
|
|
|
|
cli = MainCli.new(self)
|
2026-11-10 18:30:13 -06:00
|
|
|
selecting = MainSelection.new(self)
|
Help: topics for every new feature, a cheat sheet, and Try a demo spreads
Twelve new Help topics (menus, selecting and resizing, nested groups,
themes, List view, the Book, rolling more than once, pausing, costs,
one table adjusting another, sheets and saving, pictures, phones), and a
Keyboard shortcuts topic split into keys, mouse and touch. Topics with
[demo]key[/demo] get a 'Try a demo spread' link: DemoSpreads builds a
small example, DemoMode shows it unsaved and unlisted with Keep a copy
and Back to my spread. --demo=KEY opens one from the command line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:24:57 -06:00
|
|
|
demo = DemoMode.new(self)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
prompt_hook = rolling._ask_player
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
func _ready() -> void:
|
|
|
|
|
rng.randomize()
|
2026-11-10 18:24:23 -06:00
|
|
|
# The project keeps its old internal name so the user:// folder (saved
|
|
|
|
|
# spreads) doesn't move; the window shows the app's name.
|
|
|
|
|
get_window().title = "Table Tarot"
|
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 args := OS.get_cmdline_user_args()
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
if args.has("--sample") or MainCli._arg_value(args, "--screenshot") != "":
|
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
|
|
|
_saving_enabled = false
|
|
|
|
|
if _saving_enabled:
|
2026-11-10 19:45:37 -06:00
|
|
|
layout._open_library()
|
Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
if ThemeStore.carry_board != null:
|
|
|
|
|
if not _saving_enabled:
|
|
|
|
|
data = ThemeStore.carry_board
|
|
|
|
|
ThemeStore.carry_board = null
|
Theme tiers 1-2: theme folders, mascot recolour, background scene and tile, frame sets, picture threads, sounds; nine new built-in themes
- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame;
ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt
recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays
roll / card turn / thread / click / ambient with View > Sound levels.
- Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal:
generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs).
- Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:05:40 -06:00
|
|
|
var forced_theme := MainCli._arg_value(args, "--theme")
|
|
|
|
|
if forced_theme != "":
|
|
|
|
|
ThemeStore.apply(ThemeStore.find(forced_theme))
|
|
|
|
|
elif ThemeStore.current.is_empty():
|
Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
ThemeStore.apply(ThemeStore.find(str(state.get_setting(ThemeStore.SETTING, ThemeStore.DEFAULT_ID)) if state else ThemeStore.DEFAULT_ID))
|
|
|
|
|
theme = Style.app_theme()
|
Theme tiers 1-2: theme folders, mascot recolour, background scene and tile, frame sets, picture threads, sounds; nine new built-in themes
- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame;
ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt
recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays
roll / card turn / thread / click / ambient with View > Sound levels.
- Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal:
generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs).
- Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:05:40 -06:00
|
|
|
sound = SoundBoard.new(self)
|
|
|
|
|
add_child(sound)
|
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 data == null:
|
|
|
|
|
data = SampleBoard.create()
|
2026-11-08 12:11:26 -06:00
|
|
|
data.id = "fantasy-loot"
|
|
|
|
|
data.name = "Fantasy Loot"
|
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
|
|
|
|
2026-11-10 19:45:37 -06:00
|
|
|
layout._build_ui()
|
2026-11-10 18:58:33 -06:00
|
|
|
add_child(TouchInput.new(self))
|
|
|
|
|
if MobileLayout.wanted():
|
|
|
|
|
mobile = MobileLayout.new(self)
|
|
|
|
|
mobile.apply()
|
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_cards()
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
rolling._seed_session()
|
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
|
|
|
# Let the cards lay out before fitting them to the window.
|
|
|
|
|
await get_tree().process_frame
|
|
|
|
|
await get_tree().process_frame
|
|
|
|
|
board.fit()
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
cli._run_cli(args)
|
2026-11-16 10:41:13 -06:00
|
|
|
WelcomeDialog.maybe_show(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
|
|
|
|
|
|
|
|
func _exit_tree() -> void:
|
2026-11-08 12:11:26 -06:00
|
|
|
_save_now()
|
|
|
|
|
|
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
|
|
|
# ---------- Cards ----------
|
|
|
|
|
|
|
|
|
|
func card_for(id: String) -> TableCard:
|
|
|
|
|
return cards.get(id)
|
|
|
|
|
|
|
|
|
|
func is_entry_lit(tid: String, eid: String) -> bool:
|
|
|
|
|
return lit_entries.has(Roller.entry_key(tid, eid))
|
|
|
|
|
|
2026-11-14 13:28:31 -06:00
|
|
|
# ---------- Live cards and pop-ups ----------
|
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
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
## Re-renders the live cards (variables, sheets, questions). Called after a
|
|
|
|
|
## roll, after variable edits and after edits in Build, never per frame, so
|
|
|
|
|
## dice inside {= } don't re-roll all the time.
|
|
|
|
|
func refresh_live() -> void:
|
|
|
|
|
for card in cards.values():
|
|
|
|
|
(card as TableCard).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
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func _add_modal(d: ModalCard) -> void:
|
|
|
|
|
add_child(d)
|
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
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
## The shared hover pop-up for details.
|
|
|
|
|
func details() -> DetailsPopup:
|
|
|
|
|
if _details_popup == null:
|
|
|
|
|
_details_popup = DetailsPopup.new()
|
|
|
|
|
add_child(_details_popup)
|
|
|
|
|
_details_popup.setup(self)
|
|
|
|
|
return _details_popup
|
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
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
# ---------- Delegators: what other files call on Main ----------
|
2026-11-14 13:28:31 -06:00
|
|
|
# One block per helper; each line pair passes the call straight on.
|
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
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func toast(message: String, undoable: bool = false) -> void:
|
|
|
|
|
top_bar.toast(message, undoable)
|
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
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func add_variable_card(label: String, var_name: String, type: String = "number") -> RollTable:
|
|
|
|
|
return editing.add_variable_card(label, var_name, type)
|
|
|
|
|
func add_entry(tid: String) -> void:
|
|
|
|
|
editing.add_entry(tid)
|
|
|
|
|
func delete_entry(tid: String, eid: String) -> void:
|
|
|
|
|
editing.delete_entry(tid, eid)
|
|
|
|
|
func delete_table(tid: String) -> void:
|
|
|
|
|
editing.delete_table(tid)
|
|
|
|
|
func remove_pipe(key: String) -> void:
|
|
|
|
|
editing.remove_pipe(key)
|
|
|
|
|
func start_link(tid: String, eid: String) -> void:
|
|
|
|
|
editing.start_link(tid, eid)
|
|
|
|
|
func update_link() -> void:
|
|
|
|
|
editing.update_link()
|
|
|
|
|
func finish_link() -> void:
|
|
|
|
|
editing.finish_link()
|
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
|
|
|
func is_selected(tid: String) -> bool:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return editing.is_selected(tid)
|
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
|
|
|
func toggle_selected(tid: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
editing.toggle_selected(tid)
|
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
|
|
|
func clear_selection() -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
editing.clear_selection()
|
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
|
|
|
func select_in_rect(r: Rect2) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
editing.select_in_rect(r)
|
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
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func group_node(gid: String) -> GroupCard:
|
|
|
|
|
return grouping.group_node(gid)
|
|
|
|
|
func hidden_groups() -> Dictionary:
|
|
|
|
|
return grouping.hidden_groups()
|
|
|
|
|
func lit_keys_for_group(g: TableGroup) -> Array:
|
|
|
|
|
return grouping.lit_keys_for_group(g)
|
|
|
|
|
func toggle_group(gid: String) -> void:
|
|
|
|
|
grouping.toggle_group(gid)
|
|
|
|
|
func move_group(gid: String, delta: Vector2) -> void:
|
|
|
|
|
grouping.move_group(gid, delta)
|
|
|
|
|
func ungroup(gid: String) -> void:
|
|
|
|
|
grouping.ungroup(gid)
|
|
|
|
|
func confirm_delete_group(gid: String) -> void:
|
|
|
|
|
grouping.confirm_delete_group(gid)
|
|
|
|
|
func edit_group_details(gid: String) -> void:
|
|
|
|
|
grouping.edit_group_details(gid)
|
|
|
|
|
func begin_card_drag(card: TableCard) -> void:
|
2026-11-14 13:28:31 -06:00
|
|
|
grouping.card_drag.begin_card_drag(card)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func drag_card(card: TableCard, to: Vector2) -> void:
|
2026-11-14 13:28:31 -06:00
|
|
|
grouping.card_drag.drag_card(card, to)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func end_card_drag(_card: TableCard) -> void:
|
2026-11-14 13:28:31 -06:00
|
|
|
grouping.card_drag.end_card_drag(_card)
|
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
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func save_template_from(table_ids: Array, kind: String, group_ids: Array = []) -> void:
|
|
|
|
|
templating.save_template_from(table_ids, kind, group_ids)
|
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
|
|
|
func begin_template_insert(tpl: Dictionary) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
templating.begin_template_insert(tpl)
|
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
|
|
|
func export_template(id: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
templating.export_template(id)
|
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
|
|
|
func import_template_file(picker: TemplatePicker = null) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
templating.import_template_file(picker)
|
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
|
|
|
|
2026-11-08 12:53:39 -06:00
|
|
|
func start_roll(tid: String, fast: bool = false) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
await rolling.start_roll(tid, fast)
|
|
|
|
|
func copy_current(kind: int) -> void:
|
|
|
|
|
rolling.copy_current(kind)
|
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
|
|
|
|
2026-11-08 12:23:21 -06:00
|
|
|
func collections_enabled() -> bool:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return collections.collections_enabled()
|
2026-11-08 12:23:21 -06:00
|
|
|
func open_table_settings(table_id: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
collections.open_table_settings(table_id)
|
2026-11-08 12:23:21 -06:00
|
|
|
func switch_collection(id: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
collections.switch_collection(id)
|
2026-11-14 19:19:47 -06:00
|
|
|
func new_collection(folder: String = "") -> void:
|
|
|
|
|
collections.new_collection(folder)
|
2026-11-08 12:23:21 -06:00
|
|
|
func rename_collection() -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
collections.rename_collection()
|
2026-11-08 12:23:21 -06:00
|
|
|
func duplicate_collection() -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
collections.duplicate_collection()
|
2026-11-08 12:23:21 -06:00
|
|
|
func delete_collection() -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
collections.delete_collection()
|
2026-11-08 12:23:21 -06:00
|
|
|
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
func cards_left(tid: String) -> Vector2i:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return local_state.cards_left(tid)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
func reshuffle_table(tid: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
local_state.reshuffle_table(tid)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
func lit_text(tid: String, eid: String) -> String:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return local_state.lit_text(tid, eid)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
func ref_targets_for(e: TableEntry) -> Array[String]:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return local_state.ref_targets_for(e)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
func set_variable(name: String, value: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
local_state.set_variable(name, value)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
func clear_variable(name: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
local_state.clear_variable(name)
|
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
|
|
|
func variable_card(name: String) -> RollTable:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return local_state.variable_card(name)
|
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
|
|
|
func variable_names() -> Array[String]:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return local_state.variable_names()
|
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
|
|
|
func reset_variable(name: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
local_state.reset_variable(name)
|
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
|
|
|
func reset_all_variables() -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
local_state.reset_all_variables()
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
func reroll_variable(name: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
local_state.reroll_variable(name)
|
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
|
|
|
func can_reroll_variable(name: String) -> bool:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return local_state.can_reroll_variable(name)
|
|
|
|
|
func set_collection_member(t: RollTable, item: String, value: String) -> void:
|
|
|
|
|
local_state.set_collection_member(t, item, value)
|
|
|
|
|
func remove_collection_member(t: RollTable, item: String) -> void:
|
|
|
|
|
local_state.remove_collection_member(t, item)
|
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
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func focus_table(table_id: String, entry_id: String = "") -> void:
|
|
|
|
|
await nav.focus_table(table_id, entry_id)
|
|
|
|
|
func focus_group(gid: String) -> void:
|
|
|
|
|
nav.focus_group(gid)
|
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
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func mark_dirty(label: String = "", undoable: bool = true) -> void:
|
|
|
|
|
undo_redo.mark_dirty(label, undoable)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
|
|
|
|
|
func open_pipe_options(key: String, at: Vector2) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
inspecting.open_pipe_options(key, at)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
func request_table_settings(tid: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
inspecting.request_table_settings(tid)
|
2026-11-08 21:24:25 -06:00
|
|
|
func select_card(table_id: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
inspecting.select_card(table_id)
|
2026-11-08 21:24:25 -06:00
|
|
|
func select_result(table_id: String, entry_id: String) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
inspecting.select_result(table_id, entry_id)
|
2026-11-08 21:24:25 -06:00
|
|
|
func clear_inspector() -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
inspecting.clear_inspector()
|
2026-11-08 21:24:25 -06:00
|
|
|
func inspector_selection() -> Dictionary:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return inspecting.inspector_selection()
|
2026-11-08 21:24:25 -06:00
|
|
|
func inspector_edited(tid: String, all_cards: bool = false) -> void:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
inspecting.inspector_edited(tid, all_cards)
|
2026-11-10 19:45:37 -06:00
|
|
|
|
|
|
|
|
# ---------- Delegators to MainLayout ----------
|
|
|
|
|
|
|
|
|
|
func _save_now() -> void:
|
|
|
|
|
layout._save_now()
|
|
|
|
|
func _rebuild_cards() -> void:
|
|
|
|
|
layout._rebuild_cards()
|
|
|
|
|
func _refresh_lit() -> void:
|
|
|
|
|
layout._refresh_lit()
|
|
|
|
|
func set_mode(m: Mode) -> void:
|
|
|
|
|
layout.set_mode(m)
|
|
|
|
|
func _board_changed() -> void:
|
|
|
|
|
layout._board_changed()
|
|
|
|
|
func _any_expanded() -> bool:
|
|
|
|
|
return layout._any_expanded()
|
|
|
|
|
func toggle_collapse(tid: String) -> void:
|
|
|
|
|
layout.toggle_collapse(tid)
|
|
|
|
|
func set_all_collapsed(collapsed: bool) -> void:
|
|
|
|
|
layout.set_all_collapsed(collapsed)
|
|
|
|
|
|
|
|
|
|
## Opens the system file dialog; `on_path` gets the chosen path.
|
|
|
|
|
func file_dialog(title: String, filters: Array, mode: FileDialog.FileMode, on_path: Callable, file_name: String = "") -> void:
|
|
|
|
|
layout.file_dialog(title, filters, mode, on_path, file_name)
|
|
|
|
|
func export_dialog(title: String, filter: String, file_name: String, text_for: Callable) -> void:
|
|
|
|
|
layout.export_dialog(title, filter, file_name, text_for)
|
|
|
|
|
|
|
|
|
|
## "plain" (Describe's phrases) or "text" (the stored rule text).
|
|
|
|
|
func rules_view() -> String:
|
|
|
|
|
return layout.rules_view()
|
|
|
|
|
func rules_plain() -> bool:
|
|
|
|
|
return layout.rules_plain()
|
|
|
|
|
func set_rules_view(v: String) -> void:
|
|
|
|
|
layout.set_rules_view(v)
|
|
|
|
|
func _shortcut_input(ev: InputEvent) -> void:
|
|
|
|
|
layout._shortcut_input(ev)
|
|
|
|
|
func _unhandled_input(ev: InputEvent) -> void:
|
|
|
|
|
layout._unhandled_input(ev)
|