aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/swarm
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-10-07 23:12:19 -0500
committermat <git@matdoes.dev>2023-10-07 23:12:19 -0500
commit971f42e3dbee8de614573450fc9548c008f3b3b5 (patch)
treec51b24d6bc6f0af7aaa88c099fd646142218768e /azalea/src/swarm
parent9281e4fdb96fda7cef383e10611029c45538fbf2 (diff)
downloadazalea-drasl-971f42e3dbee8de614573450fc9548c008f3b3b5.tar.xz
split pathfinder execution into multiple systems (and fix some bugs)
Diffstat (limited to 'azalea/src/swarm')
-rw-r--r--azalea/src/swarm/mod.rs6
1 files changed, 5 insertions, 1 deletions
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::<S>();
- 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()));
+ }
}
}