From bd1cb17c36b538a4739585c3c0ee2feca322c1fb Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Fri, 10 Jul 2026 21:05:32 -0700 Subject: [PATCH] sorta fixed loading cells, but now limited cellpitch is not respected... --- life/src/main.rs | 122 ++++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 60 deletions(-) diff --git a/life/src/main.rs b/life/src/main.rs index da9f04a..c9f3b59 100644 --- a/life/src/main.rs +++ b/life/src/main.rs @@ -1,3 +1,7 @@ +#![allow(clippy::complexity)] +// Only because of FromTemplat macros unfortunately... +#![allow(dead_code)] + use bevy::{ feathers::{containers::*, theme::ThemeProps}, ui::{Checked, InteractionDisabled}, @@ -590,6 +594,7 @@ fn new_cell( sinks: &Query>, sim_state: &Res>, audio_state: &Res>, + pitch_map: &Res, ) -> impl Scene { let c = Coordinates { x, y }; @@ -605,14 +610,19 @@ fn new_cell( let playback_settings = PlaybackSettings::ONCE.with_volume(volume); + info!("using coordinates {:?}", c); + info!("cell_pitch: {:?}", pitch_map.coordinates_cell_pitch(&c)); + info!("pitch map {:?}", pitch_map); + info!("cell assets materials: {:#?}", cell_assets.materials); + bsn! { Cell Coordinates { x, y } template_value(playback_settings) template_value(Transform::from_translation(c.as_translation() + Vec3::new(0.0, 0.0, 1.0))) template_value(Mesh2dTemplate(cell_assets.mesh.clone().into())) - // TODO: template_value(AudioPlayerTemplate(cell_assets.pitches.get(&pitch_map.coordinates_cell_pitch(c)).unwrap().clone().into())) - // TODO: template_value(MeshMaterial2dTemplate(cell_assets.materials.get(&pitch_map.coordinates_cell_pitch(c)).unwrap().clone().into())) + template_value(AudioPlayerTemplate(cell_assets.pitches.get(&pitch_map.coordinates_cell_pitch(&c)).unwrap().clone().into())) + template_value(MeshMaterial2dTemplate(cell_assets.materials.get(&pitch_map.coordinates_cell_pitch(&c)).unwrap().clone().into())) } } @@ -623,6 +633,7 @@ fn cell_lifecycle( query: Query>, sim_state: Res>, audio_state: Res>, + pitch_map: Res, ) { reader.read().for_each(|msg| match msg { Lifecycle::Alive(c) => { @@ -634,6 +645,7 @@ fn cell_lifecycle( &query, &sim_state, &audio_state, + &pitch_map, )); } Lifecycle::Dead(e) => { @@ -657,7 +669,7 @@ fn cooldown_secs(input: f32) -> impl FnMut(Local, Res