Skip to main content

siglus_scene_vm/runtime/forms/
timewait.rs

1use crate::runtime::{CommandContext, ProcKind, Value};
2use anyhow::Result;
3
4pub fn dispatch(ctx: &mut CommandContext, allow_key_skip: bool, args: &[Value]) -> Result<bool> {
5    let ms = args.get(0).and_then(|v| v.as_i64()).unwrap_or(0).max(0) as u64;
6    if ms == 0 {
7        return Ok(true);
8    }
9
10    if allow_key_skip {
11        ctx.wait.wait_ms_key(ms);
12    } else {
13        ctx.wait.wait_ms(ms);
14    }
15    ctx.request_wait_proc_boundary(ProcKind::TimeWait);
16
17    Ok(true)
18}