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 RollTable
|
|
|
|
|
|
extends RefCounted
|
|
|
|
|
|
## A named list of entries placed on the board.
|
|
|
|
|
|
##
|
2026-11-08 12:11:43 -06:00
|
|
|
|
## Plain tables pick by entry weight (6 equal entries = d6). If any entry has a
|
|
|
|
|
|
## range, the table becomes a ranged dice table (1d100 by default, or any dice
|
|
|
|
|
|
## expression) where the probability mass of each range sets its chance.
|
|
|
|
|
|
|
|
|
|
|
|
const DEFAULT_DICE := "1d100"
|
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 id: String = ""
|
|
|
|
|
|
var name: String = ""
|
|
|
|
|
|
var position: Vector2 = Vector2.ZERO
|
|
|
|
|
|
var collapsed: bool = false
|
2026-11-08 12:11:43 -06:00
|
|
|
|
## Longer description (may contain BBCode).
|
|
|
|
|
|
var details: String = ""
|
|
|
|
|
|
var tags: Array[String] = []
|
|
|
|
|
|
## Dice expression for ranged tables, e.g. "1d100", "2d6", "1d8+2".
|
|
|
|
|
|
var dice: String = DEFAULT_DICE
|
|
|
|
|
|
## Card mode: entries are drawn without replacement until the deck is empty.
|
|
|
|
|
|
var card_mode: bool = false
|
|
|
|
|
|
## What happens when the deck runs out: "reshuffle" or "stop".
|
|
|
|
|
|
var deck_empty: String = "reshuffle"
|
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 entries: Array[TableEntry] = []
|
|
|
|
|
|
|
2026-11-08 12:11:43 -06:00
|
|
|
|
var _dice_cache: Dice = null
|
|
|
|
|
|
var _dice_cache_text: String = ""
|
|
|
|
|
|
|
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(p_id: String = "", p_name: String = "") -> void:
|
|
|
|
|
|
id = p_id
|
|
|
|
|
|
name = p_name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func is_ranged() -> bool:
|
|
|
|
|
|
for e in entries:
|
|
|
|
|
|
if e.has_range:
|
|
|
|
|
|
return true
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-11-08 12:11:43 -06:00
|
|
|
|
## The parsed dice expression (falls back to 1d100 if `dice` is invalid).
|
|
|
|
|
|
func dice_obj() -> Dice:
|
|
|
|
|
|
if _dice_cache == null or _dice_cache_text != dice:
|
|
|
|
|
|
var d := Dice.parse(dice)
|
|
|
|
|
|
_dice_cache = d if d.valid else Dice.make(1, 100)
|
|
|
|
|
|
_dice_cache_text = dice
|
|
|
|
|
|
return _dice_cache
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Label for the dice: "d100", "2d6", "1d8+2". Plain tables label by entry count.
|
|
|
|
|
|
func dice_label() -> String:
|
|
|
|
|
|
if is_ranged():
|
|
|
|
|
|
return dice_obj().label()
|
|
|
|
|
|
return "d%d" % die_size()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Lowest value that can be rolled (1 on plain tables).
|
|
|
|
|
|
func min_value() -> int:
|
|
|
|
|
|
return dice_obj().min_value() if is_ranged() else 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Highest value that can be rolled. Plain tables: the entry count.
|
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 die_size() -> int:
|
|
|
|
|
|
if is_ranged():
|
2026-11-08 12:11:43 -06:00
|
|
|
|
return dice_obj().max_value()
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
return entries.size()
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-11-08 12:11:43 -06:00
|
|
|
|
func total_weight() -> int:
|
|
|
|
|
|
var w := 0
|
|
|
|
|
|
for e in entries:
|
|
|
|
|
|
w += maxi(0, e.weight)
|
|
|
|
|
|
return w
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
## Formats a die value the way printed tables do: d100 values are two digits
|
|
|
|
|
|
## and 100 is written "00".
|
|
|
|
|
|
func fmt(value: int) -> String:
|
2026-11-08 12:11:43 -06:00
|
|
|
|
var two_digit := dice_obj().is_d100() if is_ranged() else entries.size() == 100
|
|
|
|
|
|
if two_digit:
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
return "00" if value == 100 else "%02d" % value
|
|
|
|
|
|
return str(value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func num_label(e: TableEntry, index: int) -> String:
|
|
|
|
|
|
if not e.has_range:
|
|
|
|
|
|
return fmt(index + 1)
|
|
|
|
|
|
if e.range_lo == e.range_hi:
|
|
|
|
|
|
return fmt(e.range_lo)
|
|
|
|
|
|
return "%s–%s" % [fmt(e.range_lo), fmt(e.range_hi)]
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-11-08 12:11:43 -06:00
|
|
|
|
## Chance (0–1) that a roll lands on this entry.
|
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 chance(e: TableEntry) -> float:
|
2026-11-08 12:11:43 -06:00
|
|
|
|
if is_ranged():
|
|
|
|
|
|
if not e.has_range:
|
|
|
|
|
|
return 0.0
|
|
|
|
|
|
return dice_obj().probability_between(e.range_lo, e.range_hi)
|
|
|
|
|
|
var total := total_weight()
|
|
|
|
|
|
return float(maxi(0, e.weight)) / float(total) if total > 0 else 0.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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func entry_index_for(value: int) -> int:
|
|
|
|
|
|
for i in entries.size():
|
|
|
|
|
|
var e := entries[i]
|
|
|
|
|
|
if e.has_range and value >= e.range_lo and value <= e.range_hi:
|
|
|
|
|
|
return i
|
|
|
|
|
|
return -1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func find_entry(eid: String) -> TableEntry:
|
|
|
|
|
|
for e in entries:
|
|
|
|
|
|
if e.id == eid:
|
|
|
|
|
|
return e
|
|
|
|
|
|
return null
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-11-08 12:11:43 -06:00
|
|
|
|
## Describes gaps, overlaps and out-of-span ranges in a ranged table, or "" when clean.
|
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 range_problems() -> String:
|
|
|
|
|
|
if not is_ranged():
|
|
|
|
|
|
return ""
|
2026-11-08 12:11:43 -06:00
|
|
|
|
var lo := min_value()
|
|
|
|
|
|
var hi := die_size()
|
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 hits := PackedInt32Array()
|
2026-11-08 12:11:43 -06:00
|
|
|
|
hits.resize(hi + 1)
|
|
|
|
|
|
var outside := PackedStringArray()
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
for e in entries:
|
2026-11-08 12:11:43 -06:00
|
|
|
|
if not e.has_range:
|
|
|
|
|
|
continue
|
|
|
|
|
|
for v in range(maxi(lo, e.range_lo), mini(hi, e.range_hi) + 1):
|
|
|
|
|
|
hits[v] += 1
|
|
|
|
|
|
if e.range_lo < lo or e.range_hi > hi:
|
|
|
|
|
|
outside.append("%s–%s" % [fmt(e.range_lo), fmt(e.range_hi)])
|
|
|
|
|
|
var gaps := _runs(hits, lo, hi, func(h: int) -> bool: return h == 0)
|
|
|
|
|
|
var overlaps := _runs(hits, lo, hi, func(h: int) -> bool: return h > 1)
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
var parts := PackedStringArray()
|
|
|
|
|
|
if gaps != "":
|
|
|
|
|
|
parts.append("No result for %s." % gaps)
|
|
|
|
|
|
if overlaps != "":
|
|
|
|
|
|
parts.append("%s matches more than one result." % overlaps)
|
2026-11-08 12:11:43 -06:00
|
|
|
|
if not outside.is_empty():
|
|
|
|
|
|
parts.append("%s is outside %s–%s." % [", ".join(outside), fmt(lo), fmt(hi)])
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
return " ".join(parts)
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-11-08 12:11:43 -06:00
|
|
|
|
func _runs(hits: PackedInt32Array, lo: int, n: int, test: Callable) -> String:
|
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 out := PackedStringArray()
|
|
|
|
|
|
var start := -1
|
2026-11-08 12:11:43 -06:00
|
|
|
|
for v in range(lo, n + 2):
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
var on: bool = v <= n and test.call(hits[v])
|
|
|
|
|
|
if on and start < 0:
|
|
|
|
|
|
start = v
|
|
|
|
|
|
elif not on and start >= 0:
|
|
|
|
|
|
out.append(fmt(start) if start == v - 1 else "%s–%s" % [fmt(start), fmt(v - 1)])
|
|
|
|
|
|
start = -1
|
|
|
|
|
|
return ", ".join(out)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func to_dict() -> Dictionary:
|
|
|
|
|
|
var list: Array = []
|
|
|
|
|
|
for e in entries:
|
|
|
|
|
|
list.append(e.to_dict())
|
|
|
|
|
|
var d := {"id": id, "name": name, "x": roundi(position.x), "y": roundi(position.y), "entries": list}
|
|
|
|
|
|
if collapsed:
|
|
|
|
|
|
d["collapsed"] = true
|
2026-11-08 12:11:43 -06:00
|
|
|
|
if details != "":
|
|
|
|
|
|
d["details"] = details
|
|
|
|
|
|
if not tags.is_empty():
|
|
|
|
|
|
d["tags"] = tags.duplicate()
|
|
|
|
|
|
if is_ranged():
|
|
|
|
|
|
d["dice"] = dice
|
|
|
|
|
|
if card_mode:
|
|
|
|
|
|
d["card_mode"] = true
|
|
|
|
|
|
if deck_empty != "reshuffle":
|
|
|
|
|
|
d["deck_empty"] = deck_empty
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
|
return d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func from_dict(d: Dictionary) -> RollTable:
|
|
|
|
|
|
var t := RollTable.new(str(d.get("id", "")), str(d.get("name", "")))
|
|
|
|
|
|
t.position = Vector2(float(d.get("x", 0)), float(d.get("y", 0)))
|
|
|
|
|
|
t.collapsed = bool(d.get("collapsed", false))
|
2026-11-08 12:11:43 -06:00
|
|
|
|
t.details = str(d.get("details", ""))
|
|
|
|
|
|
for tag: Variant in d.get("tags", []):
|
|
|
|
|
|
t.tags.append(str(tag))
|
|
|
|
|
|
if d.has("dice"):
|
|
|
|
|
|
t.dice = str(d["dice"])
|
|
|
|
|
|
elif int(d.get("die", 0)) > 1:
|
|
|
|
|
|
t.dice = "1d%d" % int(d["die"])
|
|
|
|
|
|
t.card_mode = bool(d.get("card_mode", false))
|
|
|
|
|
|
t.deck_empty = "stop" if str(d.get("deck_empty", "reshuffle")) == "stop" else "reshuffle"
|
|
|
|
|
|
for ed: Variant in d.get("entries", []):
|
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 ed is Dictionary:
|
|
|
|
|
|
t.entries.append(TableEntry.from_dict(ed))
|
|
|
|
|
|
return t
|