refactor file locations for readability
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
use crate::{
|
||||
camera,
|
||||
world::generation::{
|
||||
generate_chunk_fauna, generate_chunk_foliage, generate_chunk_forrestry,
|
||||
generate_chunk_terrain, generate_chunk_weathering_and_precipitation,
|
||||
},
|
||||
};
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub mod chunks;
|
||||
pub mod generation;
|
||||
pub mod textures;
|
||||
pub mod tiles;
|
||||
|
||||
// Re-export commonly used items
|
||||
pub use chunks::management::*;
|
||||
pub use textures::management::*;
|
||||
pub use tiles::{prefabs::*, rendering::*, visibility::*};
|
||||
|
||||
// Plugin
|
||||
pub struct WorldPlugin;
|
||||
|
||||
impl Plugin for WorldPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_resource::<ChunkMap>()
|
||||
.add_event::<GenerateChunkEvent>()
|
||||
.add_event::<ChunkTerrainEvent>()
|
||||
.add_event::<ChunkWeatheringAndPrecipitationEvent>()
|
||||
.add_event::<ChunkForrestryEvent>()
|
||||
.add_event::<ChunkFoliageEvent>()
|
||||
.add_event::<ChunkFaunaEvent>()
|
||||
.add_event::<TileOcclusionEvent>()
|
||||
.add_systems(Startup, (setup_chunk_system, setup_initial_chunks).chain())
|
||||
.add_systems(
|
||||
FixedUpdate,
|
||||
(
|
||||
(
|
||||
handle_chunk_events,
|
||||
generate_chunk_terrain,
|
||||
generate_chunk_weathering_and_precipitation,
|
||||
generate_chunk_forrestry,
|
||||
generate_chunk_foliage,
|
||||
generate_chunk_fauna,
|
||||
)
|
||||
.chain(),
|
||||
chunkmap_despawn_timer_system,
|
||||
),
|
||||
)
|
||||
.add_systems(
|
||||
Update,
|
||||
(
|
||||
compute_visibility_of_game_entities,
|
||||
(
|
||||
handle_tile_occlusion_updates,
|
||||
build_quilted_terrain_sprites,
|
||||
update_tile_visibility.run_if(
|
||||
|cwss: Res<tiles::CurrentWorldSpriteState>,
|
||||
camera_moved: Res<camera::CameraMoved>| {
|
||||
cwss.state == tiles::TerrainSpriteState::RenderReady
|
||||
|| camera_moved.0
|
||||
},
|
||||
),
|
||||
)
|
||||
.chain(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn setup_initial_chunks(mut event_writer: EventWriter<GenerateChunkEvent>) {
|
||||
for x in -5..=5 {
|
||||
for y in -5..=5 {
|
||||
event_writer.write(GenerateChunkEvent {
|
||||
chunk_position: IVec2::new(x, y),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user