fix deal crash
This commit is contained in:
parent
759ff410c2
commit
65ea256436
6 changed files with 15 additions and 55 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
use crate::{
|
||||
game::wall::{Wall, WallTiles},
|
||||
game::wall::{InWall, Wall, WallTiles},
|
||||
tiles::Tile,
|
||||
};
|
||||
|
||||
|
|
@ -28,14 +28,13 @@ pub struct InHand(pub Entity);
|
|||
|
||||
pub(crate) fn deal_hands(
|
||||
mut commands: Commands,
|
||||
wall: Single<Entity, With<Wall>>,
|
||||
wall_tiles: Populated<Entity, With<WallTiles>>,
|
||||
tiles: Populated<Entity, With<Tile>>,
|
||||
inwalls: Single<&WallTiles>,
|
||||
walltiles: Single<Entity, With<WallTiles>>,
|
||||
) -> Result {
|
||||
let hand = wall_tiles.iter().collect::<Vec<_>>();
|
||||
let hand = inwalls.iter().collect::<Vec<_>>();
|
||||
|
||||
commands
|
||||
.get_entity(*wall)?
|
||||
.get_entity(*walltiles)?
|
||||
.remove_children(hand.last_chunk::<13>().unwrap());
|
||||
|
||||
commands.spawn((Hand, HandTiles(hand)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue