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 ChevronButton
|
|
|
|
|
extends Button
|
|
|
|
|
## Collapse/expand toggle: a chevron pointing down when open, right when collapsed.
|
|
|
|
|
|
|
|
|
|
var open: bool = true:
|
|
|
|
|
set(value):
|
|
|
|
|
open = value
|
|
|
|
|
queue_redraw()
|
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
|
|
|
## Drawn in light colours for the felt (see use_felt_colors).
|
|
|
|
|
var on_felt := false
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _init() -> void:
|
|
|
|
|
custom_minimum_size = Vector2(26, 26)
|
|
|
|
|
flat = false
|
|
|
|
|
focus_mode = FOCUS_ALL
|
|
|
|
|
var normal := Style.box(Color(0, 0, 0, 0), 6)
|
|
|
|
|
var hover := Style.box(Color("#e6dfcd"), 6)
|
|
|
|
|
Style.skin_button(self, normal, hover, hover, Style.MUTED)
|
|
|
|
|
mouse_entered.connect(queue_redraw)
|
|
|
|
|
mouse_exited.connect(queue_redraw)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _draw() -> void:
|
|
|
|
|
var c := size / 2.0
|
|
|
|
|
var pts: PackedVector2Array
|
|
|
|
|
if open:
|
|
|
|
|
pts = PackedVector2Array([c + Vector2(-4, -2), c + Vector2(0, 2), c + Vector2(4, -2)])
|
|
|
|
|
else:
|
|
|
|
|
pts = PackedVector2Array([c + Vector2(-2, -4), c + Vector2(2, 0), c + Vector2(-2, 4)])
|
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 on_felt:
|
|
|
|
|
draw_polyline(pts, Style.ON_FELT if is_hovered() else Style.ON_FELT_MUTED, 2.0, true)
|
|
|
|
|
else:
|
|
|
|
|
draw_polyline(pts, Style.INK if is_hovered() else Style.MUTED, 2.0, true)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Light colours, for a chevron on the felt (group title bars).
|
|
|
|
|
func use_felt_colors() -> void:
|
|
|
|
|
on_felt = true
|
|
|
|
|
var normal := Style.box(Color(0, 0, 0, 0), 6)
|
|
|
|
|
var hover := Style.box(Color(1, 1, 1, 0.08), 6)
|
|
|
|
|
Style.skin_button(self, normal, hover, hover, Style.ON_FELT_MUTED)
|
|
|
|
|
queue_redraw()
|