Registry refactor and clear queues on board entry
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user