ludic.things: a fact's record kept, in two halves swapped when a fact finds the queue empty

th_fact made a ThingFact per placement, removal and use, and the valley places and removes Things
all day. The records come back two drains after they were handed out, so a reader placing a Thing
while it reads the last drain's list never sees one change (the test holds exactly that).
thing_use takes ThingsState mut, since it pushes a fact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 12:33:44 +03:00
parent 22d1e2d66a
commit 8a4f3f5ad6
6 changed files with 52 additions and 12 deletions

View file

@ -21,7 +21,7 @@ export function thing_prompt(t: Thing) -> string {
}
# the kind does what using it does; the use is a fact whatever the kind made of it
export function thing_use(things_st: ThingsState, t: Thing) -> void {
export function thing_use(things_st: mut ThingsState, t: Thing) -> void {
if t == null or not thing_kind_ok(t.kind) { return }
let k = ThingKinds[t.kind]
th_fact(things_st, THING_USED, t)