detect hand children change instead

This commit is contained in:
Tao Tien 2026-01-18 10:52:09 -08:00
parent c7200b1fd3
commit 50ccd7fcb2
2 changed files with 3 additions and 3 deletions

View file

@ -25,8 +25,8 @@ pub struct Discarded;
// }
pub(crate) fn sort_hands(
tiles: Populated<&Tile>,
hands: Populated<&mut Children, (Changed<Hand>, Without<Player>)>,
tiles: Query<&Tile>,
hands: Query<&mut Children, (Changed<Children>, With<Hand>, Without<Player>)>,
) -> Result {
for mut hand in hands {
hand.sort_unstable_by_key(|e| tiles.get(*e).unwrap().suit);

View file

@ -155,7 +155,7 @@ pub(crate) fn discard(
curr_player: Single<Entity, With<CurrentPlayer>>,
players: Query<&Children, With<Player>>,
mut hands: Query<(&Children, Entity), (With<Hand>, Without<Player>)>,
mut hands: Query<(&Children, Entity, &mut Hand), (With<Hand>, Without<Player>)>,
drawn: Single<Entity, With<Drawn>>,
curr_turnstate: Res<State<TurnState>>,