From 98d73a2db4cd79b9b0f10a54deff8b78a0357dc3 Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 19 Apr 2022 23:20:16 -0600 Subject: [PATCH] redo this cause entitygateway isnt Clone anymore --- src/login/character.rs | 59 ++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/src/login/character.rs b/src/login/character.rs index 11d0eb0..9b9551b 100644 --- a/src/login/character.rs +++ b/src/login/character.rs @@ -258,34 +258,37 @@ async fn new_character(entity_gateway: &mut EG, user: &UserAc character_id: character.id, }).await?; - let (monomates, monofluids) = futures::future::join_all((0..4usize).map(|_| { - let mut eg = entity_gateway.clone(); - let character_id = character.id; - async move { - let monomate = eg.create_item( - NewItemEntity { - item: ItemDetail::Tool ( - Tool { - tool: item::tool::ToolType::Monomate, - })}).await?; - - eg.add_item_note(&monomate.id, ItemNote::CharacterCreation { - character_id - }).await?; - - let monofluid = eg.create_item( - NewItemEntity { - item: ItemDetail::Tool ( - Tool { - tool: item::tool::ToolType::Monofluid, - })}).await?; - - eg.add_item_note(&monofluid.id, ItemNote::CharacterCreation { - character_id - }).await?; - - Ok((monomate, monofluid)) - }})).await.into_iter().collect::, GatewayError>>()?.into_iter().unzip(); + let mut monomates = Vec::new(); + for _ in 0..4usize { + let monomate = entity_gateway.create_item( + NewItemEntity { + item: ItemDetail::Tool ( + Tool { + tool: item::tool::ToolType::Monomate, + })}).await?; + + entity_gateway.add_item_note(&monomate.id, ItemNote::CharacterCreation { + character_id: character.id + }).await?; + + monomates.push(monomate); + } + + let mut monofluids = Vec::new(); + for _ in 0..4usize { + let monofluid = entity_gateway.create_item( + NewItemEntity { + item: ItemDetail::Tool ( + Tool { + tool: item::tool::ToolType::Monofluid, + })}).await?; + + entity_gateway.add_item_note(&monofluid.id, ItemNote::CharacterCreation { + character_id: character.id + }).await?; + + monofluids.push(monofluid); + } let inventory = InventoryEntity { items: vec![InventoryItemEntity::Individual(weapon.clone()), InventoryItemEntity::Individual(armor.clone()), InventoryItemEntity::Individual(mag.clone()),