diff --git a/src/widgets/machines.rs b/src/widgets/machines.rs index f3ff949..3cfc6c3 100644 --- a/src/widgets/machines.rs +++ b/src/widgets/machines.rs @@ -37,19 +37,10 @@ impl SpawnUi for CuttingMachine { )) .with_children(|cmds| { let mut button_cmds = cmds.spawn(BigRedButton::bundle("CUT")); - button_cmds.observe( - |trigger: Trigger>, - mut com: Commands, - q: Single<(Entity, &CuttingMachine)>| { - dbg!("Cut button pressed. Triggering a FuelChanged event"); - - // Feed through the target machine, once the SpawnUi trait is updated - // to require it gets here in the first place. - - let cutting_machine = q.0; - com.trigger_targets(FuelChanged, cutting_machine); - }, - ); + button_cmds.observe(move |trigger: Trigger>, mut com: Commands| { + dbg!("Cut button pressed. Triggering a FuelChanged event"); + com.trigger_targets(FuelChanged, machine_id); + }); // TODO: Attach on-press observer so this machine can do something // in response to that button being pressed });