diff --git a/src/game/debug/terrain.rs b/src/game/debug/terrain.rs index 83ba786..00b3234 100644 --- a/src/game/debug/terrain.rs +++ b/src/game/debug/terrain.rs @@ -80,7 +80,7 @@ fn debug_painter( } else { return; }; - + for (index, key) in vec![ KeyCode::Key1, KeyCode::Key2, @@ -91,7 +91,10 @@ fn debug_painter( KeyCode::Key7, KeyCode::Key8, KeyCode::Key9, - ].iter().enumerate() { + ] + .iter() + .enumerate() + { if key_input.just_pressed(*key) { brush.tile = index as u8 + 1; } diff --git a/src/game/kinematic.rs b/src/game/kinematic.rs index 511adf6..e75023c 100644 --- a/src/game/kinematic.rs +++ b/src/game/kinematic.rs @@ -42,7 +42,6 @@ impl Default for KinematicBundle { #[derive(Component, Reflect, Default)] #[reflect(Component)] pub struct KinematicState { - // TODO: fork rapier2d to make it reflect? #[reflect(ignore)] pub last_move: Option, pub did_jump: bool, diff --git a/src/terrain2d.rs b/src/terrain2d.rs index 144cf12..a64196e 100644 --- a/src/terrain2d.rs +++ b/src/terrain2d.rs @@ -45,7 +45,12 @@ impl Plugin for Terrain2DPlugin { ); app.register_type::() - .insert_resource(Terrain2D::new(Some(WORLD_WIDTH * 2), Some(0), Some(0), Some(WORLD_WIDTH))) + .insert_resource(Terrain2D::new( + Some(WORLD_WIDTH * 2), + Some(0), + Some(0), + Some(WORLD_WIDTH), + )) .add_event::() .add_system_to_stage(TerrainStages::Simulation, terrain_simulation) .add_system_to_stage(TerrainStages::EventHandler, emit_terrain_events) @@ -69,7 +74,6 @@ pub enum TerrainStages { ChunkSync, } -// TODO: Add simulation boundaries fn terrain_simulation(mut terrain: ResMut, frame_counter: Res) { let simulation_frame = (frame_counter.frame % u8::MAX as u64) as u8 + 1; @@ -318,7 +322,7 @@ impl Terrain2D { pub fn set_texel(&mut self, global: &Vector2I, id: TexelID, simulation_frame: Option) { if !self.is_within_boundaries(global) { - return + return; } let index = global_to_chunk_index(global); let changed = match self.index_to_chunk_mut(&index) { diff --git a/src/terrain2d/texel_behaviour2d.rs b/src/terrain2d/texel_behaviour2d.rs index 7c2be5f..1c3ed6c 100644 --- a/src/terrain2d/texel_behaviour2d.rs +++ b/src/terrain2d/texel_behaviour2d.rs @@ -3,7 +3,7 @@ use crate::util::Vector2I; use super::TexelID; use bevy::prelude::*; use lazy_static::lazy_static; -use std::{collections::HashMap, borrow::Cow}; +use std::{borrow::Cow, collections::HashMap}; lazy_static! { static ref ID_MAP: HashMap = { @@ -158,7 +158,6 @@ impl Default for TexelBehaviour2D { } } -// TODO: change form-based functions like is_solid to behaviour based (e.g. has_collision) impl TexelBehaviour2D { pub const OUT_OF_BOUNDS: Self = TexelBehaviour2D { name: Cow::Borrowed(":)"), diff --git a/src/util.rs b/src/util.rs index 6ad14a4..73c4388 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,11 +1,11 @@ use bevy::prelude::*; mod collision_layers; +pub mod frame_counter; pub mod math; mod segment2_i32; mod vector2; mod vector2_i32; -pub mod frame_counter; pub use collision_layers::*; pub use segment2_i32::*;