ludic.things: things_spare_warm - spare records made up front, so play takes them from the first placement

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 12:09:52 +03:00
parent 32050879a1
commit 93e6954fb1
2 changed files with 11 additions and 0 deletions

View file

@ -62,3 +62,9 @@ export function thing_slot(t: Thing) -> int {
if t == null or t.ent < 0 { return -1 }
return t.ent & ECS_SLOT
}
# spare records made now, up to `n` waiting: a world that will place Things in play takes them
# from the first placement instead of making new ones until enough have been removed
export function things_spare_warm(things_st: mut ThingsState, n: int) -> void {
while things_spare_count(things_st) < n { push(things_st.th_spare, new Thing) }
}