only tick nonwaiting objects

This commit is contained in:
2026-07-11 12:04:33 -05:00
parent b1b723fd1b
commit f1eaaae5d0
7 changed files with 55 additions and 13 deletions
+8 -3
View File
@@ -37,12 +37,17 @@ fn init(me, state) {
### `fn tick(me, state, dt)`
Called every frame. `dt` is the elapsed time since the last tick, in seconds (a `f64`). Timed
actions pace themselves through the queue; you do not track time manually for simple walking.
Called each frame **only when this object's output queue is empty** — i.e. once its previous
actions (and any pacing `Delay`) have fully drained. While actions from an earlier tick are still
pending, the engine just advances the queue by `dt` and does **not** re-run `tick`. This means you no
longer need to guard the body with `if me.queue.length == 0` / `if !me.waiting` — the engine does it
for you, so a plain `move(North)` naturally paces itself one step per drain. `dt` is the elapsed time
since the last tick, in seconds (a `f64`). (All other hooks — `bump`/`enter`/`grab`/`send`/`init`
still fire regardless of queued actions.)
```rhai
fn tick(me, state, dt) {
if !me.waiting && !me.blocked(North) {
if !me.blocked(North) {
move(North);
}
}