Skip to content

Commit

Permalink
Fix bug, also thumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
someguynamedjosh committed Aug 29, 2022
1 parent ac0746f commit 806b287
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
Binary file modified preassets/blocks.blend
Binary file not shown.
Binary file modified preassets/menu.blend
Binary file not shown.
Binary file added preassets/thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,12 @@ pub fn simulation_interface_system(
mut world: ResMut<World>,
mut snapshot: ResMut<WorldSnapshot>,
assets: Res<AssetServer>,
interface_state: Res<InterfaceState>,
) {
for event in key_events.iter() {
if event.key_code == Some(KeyCode::Tab) && event.state == ButtonState::Pressed {
println!("{}", export_level(&*world, interface_state.first_user_part));
}
if event.key_code == Some(KeyCode::Space) && event.state == ButtonState::Pressed {
if EDITING {
// export_level(&*world);
Expand Down
28 changes: 14 additions & 14 deletions src/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,6 @@ fn run_simulation(
}
}

for output in outputs.iter() {
let parts = world.parts();
let matching_part_index = parts
.iter()
.position(|part| part.structure.matches(&output.accepts) && !part.is_hologram);
if let Some(matching_part_index) = matching_part_index {
world.remove_part(matching_part_index, &mut commands);
state.collected_outputs += 1;
if state.collected_outputs < 10 {
audio.play_with_settings(sfx.ding.clone(), PlaybackSettings::ONCE.with_volume(0.5));
}
}
}

if state.collected_outputs == 10 {
let level = global_state.current_level;
let mut num_blocks = 0;
Expand Down Expand Up @@ -297,6 +283,20 @@ fn run_simulation(
}
}

for output in outputs.iter() {
let parts = world.parts();
let matching_part_index = parts
.iter()
.position(|part| part.structure.matches(&output.accepts) && !part.is_hologram);
if let Some(matching_part_index) = matching_part_index {
world.remove_part(matching_part_index, &mut commands);
state.collected_outputs += 1;
if state.collected_outputs < 10 {
audio.play_with_settings(sfx.ding.clone(), PlaybackSettings::ONCE.with_volume(0.5));
}
}
}

let parts = world.parts();
let mut states = vec![
PhysicsState {
Expand Down

0 comments on commit 806b287

Please sign in to comment.