feat(ecs): things_now / things_changed - a consumer keeps the tick it read up to and asks only for the Things written since (untouched 64-row blocks skipped)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 22:13:45 +03:00
parent 61a6ab2e7b
commit 649a65d854
2 changed files with 35 additions and 0 deletions

View file

@ -197,4 +197,22 @@ program ThingsTest {
expect_eq(len(facts(things_st)), 3)
expect_eq(things_verify(things_st), 0)
}
test "change detection names what a verb wrote since the tick a consumer kept" (things_st: mut ThingsState) {
things_clear(things_st)
let a = put(things_st, TH_BRANCH, 1.0, 0.0)
let b = put(things_st, TH_BRANCH, 2.0, 0.0)
let seen = things_now(things_st)
let rows = words(0)
let out = new []Thing
expect_eq(things_changed(things_st, seen, rows, out), 0)
thing_hide(b)
expect_eq(things_changed(things_st, seen, rows, out), 1)
expect(out[0] == b)
let later = things_now(things_st)
thing_move(a, 9.0, 9.0, 0.0)
expect_eq(things_changed(things_st, later, rows, out), 1)
expect(out[0] == a)
expect_eq(things_changed(things_st, seen, rows, out), 2)
}
}