You are browsing as a guest. Sign up (or log in) to start making projects!

2h 48m 53s logged

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 new Platform::Time namespace, polled once a frame from Scene::Update no 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 own ScriptCommandBuffer set up on the worker just for the duration of the call, then flushed right after
  • also gc.add_root/remove_root the 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

0
31

Comments 0

No comments yet. Be the first!