From d17f5e70d14eaf5ba54cad914d8aec0c8bcc0741 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Mon, 21 Jul 2025 16:50:22 -0700 Subject: [PATCH] Handle assigning monologues Unfortunatly we don't start the dialog properly any more We also panic if no trees are avaliable... --- src/bin/trees/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bin/trees/main.rs b/src/bin/trees/main.rs index 044e8e5..ba525bb 100644 --- a/src/bin/trees/main.rs +++ b/src/bin/trees/main.rs @@ -600,6 +600,7 @@ fn spawn_debug_buttons( MonologuesList, BackgroundColor(PINK.into()), )) + .observe(assign_monologue_event) .observe(preview_monologue) .observe(toggle_debug_button_color_over) .observe(toggle_debug_button_color_out); @@ -862,3 +863,12 @@ fn spawn_tree( ) { events.write(PlantTree); } + +fn assign_monologue_event( + trigger: Trigger>, + mut events: EventWriter, + monologues: Query<&TreeMonologue>, +) { + let TreeMonologue(handle) = monologues.get(trigger.target()).unwrap(); + events.write(AssignMonologue(handle.clone())); +}