use bevy::prelude::*; use crate::{ game::wall::{Wall, WallTiles}, tiles::Tile, }; #[derive(Component)] pub(crate) struct Player { pub(crate) name: String, } fn spawn_players(mut commands: Commands) {} #[derive(Component)] pub(crate) struct Points(pub isize); #[derive(Component)] pub struct Hand; #[derive(Component)] #[relationship_target(relationship = InHand, linked_spawn)] pub struct HandTiles(Vec); #[derive(Component)] #[relationship(relationship_target = HandTiles)] pub struct InHand(pub Entity); pub(crate) fn deal_hands( mut commands: Commands, wall: Single>, wall_tiles: Populated>, tiles: Populated>, ) -> Result { let hand = wall_tiles.iter().collect::>(); commands .get_entity(*wall)? .remove_children(hand.last_chunk::<13>().unwrap()); commands.spawn((Hand, HandTiles(hand))); trace!("dealt hands"); Ok(()) }