feat(bt): Rename repeat to cycle and refactor runner

Rework task execution to be synchronous within a single tick.
Scheduling boundaries are now defined by `cycle` nodes, which
replace the previous `repeat` decorator.  All tasks are executed
immediately when scheduled, and parent/child propagation is
handled inline.
This commit is contained in:
hyper
2026-06-28 14:51:52 +08:00
parent 1253bf82d2
commit 204b9100e6
8 changed files with 254 additions and 265 deletions
+3 -3
View File
@@ -4,7 +4,7 @@
// Behaviour Tree (buildTree) — controls game flow:
// parallel
// ├── gravityTick (leaf) — generator loop, auto-drop piece on timer
// └── repeat
// └── cycle
// └── seq (sequential)
// ├── handleInput (leaf) — reads queued commands
// └── render (leaf) — draws via blessed
@@ -24,7 +24,7 @@ import {
buildTree,
leaf,
parallel,
repeat,
cycle,
sequential,
} from "../../src/bt/index";
import { CommandQueue } from "../../src/commands/index";
@@ -95,7 +95,7 @@ const runner = buildTree(
}
}
}),
repeat(
cycle(
sequential([
leaf(() => {
commands.execute();