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
|
|
|
|
class_name PipePopover
|
|
|
|
|
|
extends PopupPanel
|
|
|
|
|
|
## Build mode: the options for one pipe, opened by clicking it. How many times
|
|
|
|
|
|
## it rolls, the variable it saves its result as, and Remove.
|
|
|
|
|
|
|
|
|
|
|
|
const SAVE_PATTERN := "^@?[A-Za-z_][A-Za-z0-9_]*$"
|
|
|
|
|
|
|
|
|
|
|
|
var main: Main
|
|
|
|
|
|
var key: String = ""
|
|
|
|
|
|
var _entry: TableEntry
|
|
|
|
|
|
var _to: String = ""
|
|
|
|
|
|
var _title: RichTextLabel
|
|
|
|
|
|
var _count: LineEdit
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
|
var _count_msg: Label
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
|
var _save: LineEdit
|
|
|
|
|
|
var _save_ok: StyleBoxFlat
|
|
|
|
|
|
var _save_bad: StyleBoxFlat
|
|
|
|
|
|
var _re := RegEx.new()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func setup(p_main: Main) -> void:
|
|
|
|
|
|
main = p_main
|
|
|
|
|
|
_re.compile(SAVE_PATTERN)
|
|
|
|
|
|
theme = Style.card_theme()
|
|
|
|
|
|
var sb := Style.box(Style.CARD, 9, [14, 11, 14, 12])
|
|
|
|
|
|
sb.border_width_top = 3
|
|
|
|
|
|
sb.border_color = Style.COPPER
|
|
|
|
|
|
add_theme_stylebox_override("panel", sb)
|
|
|
|
|
|
popup_hide.connect(func() -> void:
|
|
|
|
|
|
_commit_save()
|
|
|
|
|
|
if main.board:
|
|
|
|
|
|
main.board.pipes.select_key = ""
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var v := VBoxContainer.new()
|
|
|
|
|
|
v.add_theme_constant_override("separation", 9)
|
|
|
|
|
|
add_child(v)
|
|
|
|
|
|
_title = RichText.label("", 15, Style.INK, false)
|
|
|
|
|
|
_title.custom_minimum_size = Vector2(260, 0)
|
|
|
|
|
|
v.add_child(_title)
|
|
|
|
|
|
|
|
|
|
|
|
var field_ok := Style.bordered(Style.box(Color.WHITE, 5, [7, 3, 7, 3]), 1, Style.RULE)
|
|
|
|
|
|
var field_focus := Style.bordered(Style.box(Color.WHITE, 5, [7, 3, 7, 3]), 1, Style.COPPER)
|
|
|
|
|
|
_save_ok = field_ok
|
|
|
|
|
|
_save_bad = Style.bordered(Style.box(Color.WHITE, 5, [7, 3, 7, 3]), 1, Style.DANGER)
|
|
|
|
|
|
|
|
|
|
|
|
var count_row := HBoxContainer.new()
|
|
|
|
|
|
count_row.add_theme_constant_override("separation", 6)
|
|
|
|
|
|
v.add_child(count_row)
|
|
|
|
|
|
var cl := Style.make_label("Rolls", Style.body(), 14, Style.MUTED)
|
|
|
|
|
|
cl.custom_minimum_size = Vector2(62, 0)
|
|
|
|
|
|
count_row.add_child(cl)
|
|
|
|
|
|
var minus := _small_button("−")
|
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
|
|
|
|
minus.pressed.connect(func() -> void: _set_count(str(_entry.count_for(_to) - 1) if _entry else "1"))
|
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
|
|
|
|
count_row.add_child(minus)
|
|
|
|
|
|
_count = LineEdit.new()
|
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
|
|
|
|
_count.custom_minimum_size = Vector2(64, 0)
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
|
_count.alignment = HORIZONTAL_ALIGNMENT_CENTER
|
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
|
|
|
|
_count.max_length = 60
|
|
|
|
|
|
_count.tooltip_text = "A number, or an expression such as @terms, answer or 1d3 (worked out when the pipe runs)"
|
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
|
|
|
|
_count.add_theme_stylebox_override("normal", field_ok)
|
|
|
|
|
|
_count.add_theme_stylebox_override("focus", field_focus)
|
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
|
|
|
|
_count.text_changed.connect(func(s: String) -> void:
|
|
|
|
|
|
var ok := _count_error(s) == ""
|
|
|
|
|
|
_count.add_theme_stylebox_override("normal", field_ok if ok else _save_bad)
|
|
|
|
|
|
_count.add_theme_stylebox_override("focus", field_focus if ok else _save_bad)
|
|
|
|
|
|
_count_msg.text = _count_error(s)
|
|
|
|
|
|
_count_msg.visible = not ok
|
|
|
|
|
|
reset_size()
|
|
|
|
|
|
)
|
|
|
|
|
|
_count.text_submitted.connect(func(s: String) -> void: _set_count(s))
|
|
|
|
|
|
_count.focus_exited.connect(func() -> void: _set_count(_count.text))
|
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
|
|
|
|
count_row.add_child(_count)
|
|
|
|
|
|
var plus := _small_button("+")
|
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
|
|
|
|
plus.pressed.connect(func() -> void: _set_count(str(_entry.count_for(_to) + 1) if _entry else "1"))
|
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
|
|
|
|
count_row.add_child(plus)
|
|
|
|
|
|
count_row.add_child(Style.make_label("times", Style.body(), 14, Style.MUTED))
|
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
|
|
|
|
_count_msg = Style.make_label("", Style.body(), 12, Style.DANGER_INK)
|
|
|
|
|
|
_count_msg.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
|
_count_msg.custom_minimum_size = Vector2(260, 0)
|
|
|
|
|
|
_count_msg.hide()
|
|
|
|
|
|
v.add_child(_count_msg)
|
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 save_row := HBoxContainer.new()
|
|
|
|
|
|
save_row.add_theme_constant_override("separation", 6)
|
|
|
|
|
|
v.add_child(save_row)
|
|
|
|
|
|
var sl := Style.make_label("Save as", Style.body(), 14, Style.MUTED)
|
|
|
|
|
|
sl.custom_minimum_size = Vector2(62, 0)
|
|
|
|
|
|
save_row.add_child(sl)
|
|
|
|
|
|
_save = LineEdit.new()
|
|
|
|
|
|
_save.placeholder_text = "name, or @name to keep"
|
|
|
|
|
|
_save.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
_save.add_theme_stylebox_override("normal", field_ok)
|
|
|
|
|
|
_save.add_theme_stylebox_override("focus", field_focus)
|
|
|
|
|
|
_save.text_changed.connect(func(s: String) -> void:
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
|
var ok := s.strip_edges() == "" or _re.search(TemplateKit.probe(s.strip_edges())) != null
|
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
|
|
|
|
_save.add_theme_stylebox_override("normal", _save_ok if ok else _save_bad)
|
|
|
|
|
|
_save.add_theme_stylebox_override("focus", field_focus if ok else _save_bad)
|
|
|
|
|
|
)
|
|
|
|
|
|
_save.text_submitted.connect(func(_s: String) -> void:
|
|
|
|
|
|
_commit_save()
|
|
|
|
|
|
hide()
|
|
|
|
|
|
)
|
|
|
|
|
|
save_row.add_child(_save)
|
|
|
|
|
|
var hint := Style.make_label("{name} lasts one roll; {@name} is kept.", Style.body(), 12, Style.MUTED)
|
|
|
|
|
|
v.add_child(hint)
|
|
|
|
|
|
|
|
|
|
|
|
var remove := Button.new()
|
|
|
|
|
|
remove.text = "Remove pipe"
|
|
|
|
|
|
remove.add_theme_font_size_override("font_size", 14)
|
|
|
|
|
|
var rn := Style.bordered(Style.box(Color(0, 0, 0, 0), 6, [10, 4, 10, 4]), 1, Style.DASH)
|
|
|
|
|
|
var rh := Style.bordered(Style.box(Style.WARN_BG, 6, [10, 4, 10, 4]), 1, Style.DANGER_INK)
|
|
|
|
|
|
Style.skin_button(remove, rn, rh, rh, Style.DANGER_INK)
|
|
|
|
|
|
remove.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
|
|
|
|
|
remove.pressed.connect(func() -> void:
|
|
|
|
|
|
var k := key
|
|
|
|
|
|
_entry = null
|
|
|
|
|
|
hide()
|
|
|
|
|
|
main.remove_pipe(k)
|
|
|
|
|
|
)
|
|
|
|
|
|
v.add_child(remove)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _small_button(text: String) -> Button:
|
|
|
|
|
|
var b := Button.new()
|
|
|
|
|
|
b.text = text
|
|
|
|
|
|
b.custom_minimum_size = Vector2(26, 26)
|
|
|
|
|
|
b.add_theme_font_size_override("font_size", 16)
|
|
|
|
|
|
var n := Style.bordered(Style.box(Color(0, 0, 0, 0), 5), 1, Style.RULE)
|
|
|
|
|
|
var h := Style.bordered(Style.box(Style.HOVER_ROW, 5), 1, Style.DASH)
|
|
|
|
|
|
Style.skin_button(b, n, h, h, Style.INK)
|
|
|
|
|
|
return b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Opens for the pipe `pipe_key` near `at` (window coordinates).
|
|
|
|
|
|
func open(pipe_key: String, at: Vector2) -> void:
|
|
|
|
|
|
var from := pipe_key.get_slice(">", 0)
|
|
|
|
|
|
var t := main.data.get_table(from.get_slice(":", 0))
|
|
|
|
|
|
_to = pipe_key.get_slice(">", 1)
|
|
|
|
|
|
_entry = t.find_entry(from.get_slice(":", 1)) if t else null
|
|
|
|
|
|
if _entry == null:
|
|
|
|
|
|
return
|
|
|
|
|
|
key = pipe_key
|
|
|
|
|
|
var target := main.data.get_table(_to)
|
|
|
|
|
|
_title.text = "%s [color=#%s]→[/color] [b]%s[/b]" % [RichText.preview(_entry.text, main.data), Style.COPPER.to_html(false), RichText.plain(Formatter.strip_tags(target.name)) if target else _to]
|
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
|
|
|
|
_count.text = _entry.count_text(_to)
|
|
|
|
|
|
_count.add_theme_stylebox_override("normal", _save_ok)
|
|
|
|
|
|
_count_msg.hide()
|
Play-side UI: BBCode rendering, hover details, card decks, variables, copy, ref pipes
- Cards, result chips and the Earlier list render BBCode with RichTextLabel;
Play rows show [[refs]] as teal chips and {vars} in brass, lit rows show the
rolled text; missing/unset/too-deep markers are red.
- Hover pop-up (DetailsPopup) for table headers, entries with details, result
chips and [url] metas in rendered text; items with details get a small ⓘ.
- Card-mode tables show cards left and Reshuffle; chips note reshuffles.
- Local state: decks, persistent variables and history per collection via
StateStore (memory only when saving is off); delete_table forgets its state.
- Result tray: Copy menu (text / BBCode / with details) and a Variables tab
(edit, re-roll, clear; last roll's chain variables read-only).
- Reference pipes drawn dashed from TextExpander.references; lit when used.
- Build mode: weight field, per-entry and table details editors, a gear
button for table settings, pipe popover (count, save as, remove), range
clamps use min_value(); Build cards are 300px wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:43:01 -06:00
|
|
|
|
_save.text = _entry.save_for(_to)
|
|
|
|
|
|
_save.add_theme_stylebox_override("normal", _save_ok)
|
|
|
|
|
|
main.board.pipes.select_key = pipe_key
|
|
|
|
|
|
reset_size()
|
|
|
|
|
|
var view := main.get_viewport_rect().size
|
|
|
|
|
|
var sz := get_contents_minimum_size()
|
|
|
|
|
|
var p := at + Vector2(12, 12)
|
|
|
|
|
|
p.x = clampf(p.x, 8.0, view.x - sz.x - 36.0)
|
|
|
|
|
|
p.y = clampf(p.y, 8.0, view.y - sz.y - 36.0)
|
|
|
|
|
|
popup(Rect2i(Vector2i(p), Vector2i.ZERO))
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
## Sets the count from typed text: a whole number (1–99) or an expression.
|
|
|
|
|
|
## Text that isn't a valid expression is left in the field, unsaved.
|
|
|
|
|
|
func _set_count(text: String) -> void:
|
|
|
|
|
|
if _entry == null or _count_error(text) != "":
|
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
|
|
|
|
return
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
|
var before := _entry.count_text(_to)
|
|
|
|
|
|
_entry.set_pipe_count(_to, text.strip_edges())
|
|
|
|
|
|
_count.text = _entry.count_text(_to)
|
|
|
|
|
|
if _entry.count_text(_to) != before:
|
|
|
|
|
|
main.mark_dirty()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## "" when `text` is a usable pipe count, else why not.
|
|
|
|
|
|
static func _count_error(text: String) -> String:
|
|
|
|
|
|
var s := text.strip_edges()
|
|
|
|
|
|
if s == "" or s.is_valid_int():
|
|
|
|
|
|
return ""
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
|
var err := Expr.check(TemplateKit.probe(s))
|
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
|
|
|
|
return "" if err == "" else "Not a number or expression: " + err
|
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 _commit_save() -> void:
|
|
|
|
|
|
if _entry == null:
|
|
|
|
|
|
return
|
|
|
|
|
|
var s := _save.text.strip_edges()
|
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
|
|
|
|
if s != "" and _re.search(TemplateKit.probe(s)) == null:
|
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
|
|
|
|
return
|
|
|
|
|
|
if s != _entry.save_for(_to):
|
|
|
|
|
|
_entry.set_pipe_save(_to, s)
|
|
|
|
|
|
main.mark_dirty()
|