Registry refactor and clear queues on board entry

This commit is contained in:
2026-07-06 00:41:38 -05:00
parent b7063277e7
commit 78823fcf96
9 changed files with 97 additions and 85 deletions
+5 -1
View File
@@ -73,13 +73,17 @@ impl ObjQueue {
pub fn waiting(&mut self) -> bool {
matches!(self.0.borrow().front(), Some(Action::Delay(_)))
}
pub fn clear(&mut self) {
self.0.borrow_mut().clear();
}
}
impl Registerable for ObjQueue {
fn register(engine: &mut Engine, error_sink: ErrorSink) {
engine.register_type_with_name::<ObjQueue>("Queue");
engine.register_get("length", |q: &mut ObjQueue| q.0.borrow().len() as i64);
engine.register_fn("clear", |q: &mut ObjQueue| q.0.borrow_mut().clear());
engine.register_fn("clear", ObjQueue::clear);
// Appends a [`Action::Delay`] to the back of `queue`, merging with an existing
// trailing delay to prevent adjacent delays from accumulating.