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 PortLayer
|
|
|
|
|
extends Control
|
|
|
|
|
## Draws pipe ends on top of the cards: an inlet on each card and an outlet on
|
|
|
|
|
## each result. In Build mode, dragging from an outlet lays a new pipe.
|
|
|
|
|
## Only the ports themselves take mouse input; everything else passes through.
|
|
|
|
|
|
|
|
|
|
const GRAB_RADIUS := 10.0
|
|
|
|
|
|
|
|
|
|
var main: Main
|
|
|
|
|
var _grab: Array = [] # [{pos, tid, eid}] outlets that can start a pipe
|
|
|
|
|
var _linking := false
|
|
|
|
|
var _ghost_from := Vector2.ZERO
|
|
|
|
|
var _ghost_to := Vector2.ZERO
|
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
|
|
|
var _drawn_rev := -1
|
|
|
|
|
var _drawn_hover := -1
|
|
|
|
|
var _drawn_mode := -1
|
|
|
|
|
var _drawn_far := 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:
|
|
|
|
|
mouse_filter = MOUSE_FILTER_STOP
|
|
|
|
|
mouse_default_cursor_shape = CURSOR_CROSS
|
|
|
|
|
# Controls only draw inside their own rect, so cover the whole world.
|
|
|
|
|
size = Vector2(BoardView.WORLD_SIZE, BoardView.WORLD_SIZE)
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
## Redraws only when the board's geometry changed (BoardView.geometry_rev),
|
|
|
|
|
## the outlet under the mouse changed (Build), or while a pipe is being laid.
|
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 _process(_delta: float) -> void:
|
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
|
|
|
if main == null or main.board == null:
|
|
|
|
|
return
|
|
|
|
|
var hover := _hovered_grab()
|
|
|
|
|
var far := main.board.cards.far
|
|
|
|
|
if _linking or main.board.geometry_rev != _drawn_rev or hover != _drawn_hover or main.mode != _drawn_mode or far != _drawn_far:
|
|
|
|
|
_drawn_far = far
|
|
|
|
|
_drawn_rev = main.board.geometry_rev
|
|
|
|
|
_drawn_hover = hover
|
|
|
|
|
_drawn_mode = main.mode
|
|
|
|
|
queue_redraw()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Index in _grab of the outlet under the mouse, or -1 (always -1 in Play).
|
|
|
|
|
func _hovered_grab() -> int:
|
|
|
|
|
if main.mode != Main.Mode.BUILD or _grab.is_empty():
|
|
|
|
|
return -1
|
|
|
|
|
var mouse := get_local_mouse_position()
|
|
|
|
|
for i in _grab.size():
|
|
|
|
|
if mouse.distance_to(_grab[i]["pos"]) <= GRAB_RADIUS:
|
|
|
|
|
return i
|
|
|
|
|
return -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
|
|
|
|
|
|
|
|
|
|
|
|
|
func _has_point(p: Vector2) -> bool:
|
|
|
|
|
if _linking:
|
|
|
|
|
return true
|
|
|
|
|
if main == null or main.mode != Main.Mode.BUILD:
|
|
|
|
|
return false
|
|
|
|
|
for g in _grab:
|
|
|
|
|
if p.distance_to(g["pos"]) <= GRAB_RADIUS:
|
|
|
|
|
return true
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _draw() -> void:
|
|
|
|
|
_grab.clear()
|
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
|
|
|
# Zoomed far out (BoardView.FAR_ZOOM) the ports would be specks.
|
|
|
|
|
if main.board.cards.far and not _linking:
|
|
|
|
|
return
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
var build := main.mode == Main.Mode.BUILD
|
|
|
|
|
var mouse := get_local_mouse_position()
|
|
|
|
|
for t in main.data.tables:
|
|
|
|
|
var card := main.card_for(t.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
|
|
|
if card == null or not card.is_inside_tree() or not card.visible:
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
continue
|
Logic cards UI: choice pop-up, card kinds, Build creation and settings, tray
- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:07:57 -06:00
|
|
|
# Variable cards are never rolled, so nothing pipes into them.
|
|
|
|
|
if t.kind != RollTable.KIND_VARIABLE:
|
|
|
|
|
_port(card.inlet_point(), Style.COPPER, Style.COPPER_DARK, 1.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
|
|
|
for e in t.entries:
|
|
|
|
|
if not card.rows.has(e.id):
|
|
|
|
|
continue
|
|
|
|
|
var a := card.anchor_for(e.id)
|
|
|
|
|
if a.is_empty() or not a["visible"]:
|
|
|
|
|
continue
|
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 on := not e.pipes.is_empty() or not main.ref_targets_for(e).is_empty()
|
Build the pipe-board app in Godot
Tables are cards on a felt board, joined by copper pipes that carry a
roll from one table to the next. Play mode rolls with a flicker and a
bead down each pipe; Build mode edits names, results, ranges and pipes.
- core/: data model (RollTable, TableEntry, TowerBoard), sample board
with a d100 table of 100 trinkets and a weighted d100 range table,
and a Roller with a depth limit
- ui/: board with pan and zoom, pipe and port layers, collapsible table
cards, result tray with earlier rolls, undo toasts, and a Collapse all
/ Expand all button
- assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL)
- tests/test_roller.gd: headless checks for the model and roller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:05:41 -06:00
|
|
|
if not build and not on:
|
|
|
|
|
continue
|
|
|
|
|
var pos: Vector2 = a["pos"]
|
|
|
|
|
var fill := Style.COPPER if on else Style.CARD
|
|
|
|
|
var ring := Style.COPPER_DARK
|
|
|
|
|
var s := 1.0
|
|
|
|
|
if on and main.is_entry_lit(t.id, e.id):
|
|
|
|
|
fill = Style.BRASS
|
|
|
|
|
ring = Style.BRASS_DARK
|
|
|
|
|
if build and pos.distance_to(mouse) <= GRAB_RADIUS and not _linking:
|
|
|
|
|
fill = Style.BRASS
|
|
|
|
|
s = 1.2
|
|
|
|
|
_port(pos, fill, ring, s)
|
|
|
|
|
if build:
|
|
|
|
|
_grab.append({"pos": pos, "tid": t.id, "eid": e.id})
|
|
|
|
|
if card.more_row != null:
|
|
|
|
|
var m := card.anchor_for("")
|
|
|
|
|
var on_hidden := card.hidden_has_pipes()
|
|
|
|
|
if not m.is_empty() and (on_hidden or build):
|
|
|
|
|
_port(m["pos"], Style.COPPER if on_hidden else Style.CARD, Style.COPPER_DARK, 1.0)
|
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
|
|
|
# Collapsed groups: an inlet, and an outlet wherever member pipes leave.
|
|
|
|
|
for g in main.data.groups:
|
|
|
|
|
if g.collapsed:
|
|
|
|
|
var gn := main.group_node(g.id)
|
|
|
|
|
if gn and gn.is_inside_tree():
|
|
|
|
|
_port(gn.inlet_point(), Style.COPPER, Style.COPPER_DARK, 1.0)
|
|
|
|
|
var gp: Dictionary = main.board.pipes.group_ports
|
|
|
|
|
for p: Vector2i in gp:
|
|
|
|
|
if gp[p]:
|
|
|
|
|
_port(Vector2(p), Style.BRASS, Style.BRASS_DARK, 1.0)
|
|
|
|
|
else:
|
|
|
|
|
_port(Vector2(p), Style.COPPER, Style.COPPER_DARK, 1.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
|
|
|
if _linking:
|
|
|
|
|
_draw_ghost(PipeLayer.curve(_ghost_from, _ghost_to))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _port(pos: Vector2, fill: Color, ring: Color, s: float) -> void:
|
|
|
|
|
draw_circle(pos, 8.0 * s, ring)
|
|
|
|
|
draw_circle(pos, 5.0 * s, fill)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _draw_ghost(pts: PackedVector2Array) -> void:
|
|
|
|
|
var carry := 0.0
|
|
|
|
|
for i in range(1, pts.size()):
|
|
|
|
|
var a := pts[i - 1]
|
|
|
|
|
var b := pts[i]
|
|
|
|
|
var seg := a.distance_to(b)
|
|
|
|
|
var d := carry
|
|
|
|
|
while d < seg:
|
|
|
|
|
draw_circle(a.lerp(b, d / seg), 2.5, Style.BRASS)
|
|
|
|
|
d += 11.0
|
|
|
|
|
carry = d - seg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _gui_input(ev: InputEvent) -> void:
|
|
|
|
|
var mb := ev as InputEventMouseButton
|
|
|
|
|
if mb and mb.button_index == MOUSE_BUTTON_LEFT:
|
|
|
|
|
if mb.pressed:
|
|
|
|
|
for g in _grab:
|
|
|
|
|
if mb.position.distance_to(g["pos"]) <= GRAB_RADIUS:
|
|
|
|
|
_linking = true
|
|
|
|
|
_ghost_from = g["pos"]
|
|
|
|
|
_ghost_to = mb.position
|
|
|
|
|
main.start_link(g["tid"], g["eid"])
|
|
|
|
|
accept_event()
|
|
|
|
|
return
|
|
|
|
|
elif _linking:
|
|
|
|
|
_linking = false
|
|
|
|
|
main.finish_link()
|
|
|
|
|
accept_event()
|
|
|
|
|
return
|
|
|
|
|
var mm := ev as InputEventMouseMotion
|
|
|
|
|
if mm and _linking:
|
|
|
|
|
_ghost_to = mm.position
|
|
|
|
|
main.update_link()
|
|
|
|
|
accept_event()
|