From 971f42e3dbee8de614573450fc9548c008f3b3b5 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 7 Oct 2023 23:12:19 -0500 Subject: split pathfinder execution into multiple systems (and fix some bugs) --- azalea/src/swarm/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'azalea/src/swarm') diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 66e5ea23..18c92438 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -390,7 +390,11 @@ where while let Some((Some(event), bot)) = bots_rx.recv().await { if let Some(handler) = &self.handler { let state = bot.component::(); - tokio::spawn((handler)(bot, event, state)); + tokio::spawn((handler)(bot, event, state.clone())); + // this makes it not have to keep locking the ecs + while let Ok((Some(event), bot)) = bots_rx.try_recv() { + tokio::spawn((handler)(bot, event, state.clone())); + } } } -- cgit v1.2.3