From f0b58c7e748e1e94ad0dd08124cfc186e865709c Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 18 Nov 2023 20:44:49 -0600 Subject: share registries in swarms and fix some bugs --- azalea/src/swarm/mod.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'azalea/src') diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 05aabe68..0a263f39 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -394,9 +394,7 @@ where let first_bot_state = first_bot.component::(); let first_bot_entity = first_bot.entity; - let mut tasks = Vec::new(); - - tasks.push((handler)(first_bot, first_event, first_bot_state.clone())); + tokio::spawn((handler)(first_bot, first_event, first_bot_state.clone())); // this makes it not have to keep locking the ecs let mut states = HashMap::new(); @@ -405,10 +403,8 @@ where let state = states .entry(bot.entity) .or_insert_with(|| bot.component::().clone()); - tasks.push((handler)(bot, event, state.clone())); + tokio::spawn((handler)(bot, event, state.clone())); } - - tokio::spawn(join_all(tasks)); } } -- cgit v1.2.3