Migration works
This commit is contained in:
+17
-3
@@ -3,15 +3,20 @@ use crate::basic::{IntoImage, Table};
|
||||
use bevy::asset::{Assets, RenderAssetUsages};
|
||||
use bevy::image::{BevyDefault, Image};
|
||||
use bevy::input::ButtonInput;
|
||||
use bevy::prelude::{Commands, Component, Entity, KeyCode, Query, ResMut, Sprite};
|
||||
use bevy::prelude::{Commands, Component, Entity, KeyCode, Query, Res, ResMut, Sprite};
|
||||
use bevy::render::render_resource::{Extent3d, TextureDimension, TextureFormat};
|
||||
use rand::RngExt;
|
||||
use rand_chacha::ChaCha8Rng;
|
||||
use crate::plate_automation::PlateAutomation;
|
||||
|
||||
pub fn update_automation_view_seed(
|
||||
query: Query<(&Sprite, &SeedAutomation)>,
|
||||
mut images: ResMut<Assets<Image>>,
|
||||
) {
|
||||
if query.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
let (sprite, automation) = query.iter().next().unwrap();
|
||||
let size = automation.world.side as u32;
|
||||
let data = automation.world.get_image_data();
|
||||
@@ -34,15 +39,24 @@ pub fn update_automation_view_seed(
|
||||
pub fn update_automation_seed(
|
||||
mut query: Query<(&mut SeedAutomation, Entity)>,
|
||||
mut seeded_rng: ResMut<SeededRng>,
|
||||
keys: ResMut<ButtonInput<KeyCode>>,
|
||||
keys: Res<ButtonInput<KeyCode>>,
|
||||
mut commands: Commands) {
|
||||
|
||||
if query.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
let (mut automation, entity) = query.iter_mut().next().unwrap();
|
||||
|
||||
if keys.just_pressed(KeyCode::Space){
|
||||
let random = &mut seeded_rng.0;
|
||||
automation.next(random)
|
||||
}
|
||||
if keys.just_pressed(KeyCode::Tab){
|
||||
commands.entity(entity).;
|
||||
println!("Switching to PlateAutomation");
|
||||
commands.entity(entity).remove::<SeedAutomation>().insert(PlateAutomation{
|
||||
world: automation.world.clone()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user