@@ -4,7 +4,8 @@ use crate::{
44 assets:: indexing:: IndexMap ,
55 gameplay:: {
66 hud:: inspect:: { InspectedEntity , InspectionMenuState } ,
7- recipe:: { Inputs , Outputs , assets:: RecipeDef , select:: SelectedRecipe } ,
7+ item:: inventory:: Slots ,
8+ recipe:: { Input , Output , assets:: RecipeDef , select:: SelectedRecipe } ,
89 } ,
910 widgets:: {
1011 self ,
@@ -24,16 +25,17 @@ pub fn plugin(app: &mut App) {
2425#[ reflect( Component ) ]
2526pub struct HeldRelic ( Entity ) ;
2627
27- #[ allow( clippy:: too_many_arguments) ]
2828pub fn open_recipe_menu (
2929 mut commands : Commands ,
3030 inspected_entity : Res < InspectedEntity > ,
31- structure_query : Query < ( & SelectedRecipe , & Inputs , & Outputs ) > ,
31+ structure_query : Query < ( & SelectedRecipe , & Slots ) > ,
32+ input_query : Query < ( ) , With < Input > > ,
33+ output_query : Query < ( ) , With < Output > > ,
3234 recipes : Res < Assets < RecipeDef > > ,
3335 recipe_index : Res < IndexMap < RecipeDef > > ,
3436 held_relics : Query < & HeldRelic > ,
3537) {
36- let Ok ( ( selected_recipe, inputs , outputs ) ) = structure_query. get ( inspected_entity. 0 ) else {
38+ let Ok ( ( selected_recipe, slots ) ) = structure_query. get ( inspected_entity. 0 ) else {
3739 return ;
3840 } ;
3941
@@ -117,7 +119,7 @@ pub fn open_recipe_menu(
117119 ) )
118120 . id ( ) ;
119121
120- for input in inputs . iter ( ) {
122+ for input in slots . iter ( ) . filter ( |s| input_query . contains ( * s ) ) {
121123 let slot = commands
122124 . spawn ( ( ChildOf ( input_list_id) , widgets:: slot:: slot_container ( ) ) )
123125 . id ( ) ;
@@ -190,7 +192,7 @@ pub fn open_recipe_menu(
190192 ) )
191193 . id ( ) ;
192194
193- for output in outputs . iter ( ) {
195+ for output in slots . iter ( ) . filter ( |s| output_query . contains ( * s ) ) {
194196 let slot = commands
195197 . spawn ( ( ChildOf ( output_list_id) , widgets:: slot:: slot_container ( ) ) )
196198 . id ( ) ;
0 commit comments