formatting
parent
c9d7e17a60
commit
c42859ded8
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<MoveShapeOutput>,
|
||||
pub did_jump: bool,
|
||||
|
|
|
|||
|
|
@ -45,7 +45,12 @@ impl Plugin for Terrain2DPlugin {
|
|||
);
|
||||
|
||||
app.register_type::<TerrainChunk2D>()
|
||||
.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::<TerrainEvent2D>()
|
||||
.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<Terrain2D>, frame_counter: Res<FrameCounter>) {
|
||||
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<u8>) {
|
||||
if !self.is_within_boundaries(global) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
let index = global_to_chunk_index(global);
|
||||
let changed = match self.index_to_chunk_mut(&index) {
|
||||
|
|
|
|||
|
|
@ -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<TexelID, TexelBehaviour2D> = {
|
||||
|
|
@ -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(":)"),
|
||||
|
|
|
|||
|
|
@ -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::*;
|
||||
|
|
|
|||
Loading…
Reference in New Issue