scripts can schedule stuff for later
Added SetTimeout to the scripting API
changes
SetTimeout
SetTimeout(fn, ms) calls fn() after ms milliseconds. simple to call from obsl
- timers live in a plain
std::vector<Timer>in a newPlatform::Timenamespace, polled once a frame fromScene::Updateno threads, no async bs or whatever :) - the callback itself is a
SmallTask, which falls back to a heap allocation if the closure is too big to fit inline fine for this since timeouts aren’t really a hot path - timeout callback fires from an arbitrary point in
Update, so it gets its ownScriptCommandBufferset up on the worker just for the duration of the call, then flushed right after - also
gc.add_root/remove_rootthe function around the callback so it doesn’t get collected while it’s sitting in the timer list waiting to fire
Documented it in the api reference alongside the other Time functions
also
-
tiny UI tweak in the tile editor: it now warns “no tile types defined, no map will be visible!” instead of just “no tile types defined” was seeing people get confused about why a new map looked empty after trying to paint
-
also small updates to docs in general and stuff but nothing super interesting
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.