Skip to content

Commit

Permalink
Merge pull request #454 from Miro-Andrin/Chunk
Browse files Browse the repository at this point in the history
Small refactor, moving chunk related files into a module.
  • Loading branch information
caelunshun authored Aug 23, 2021
2 parents 07c6467 + 0eeb65e commit 2039b09
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 14 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ecs::{Entity, SysResult, SystemExecutor};
use utils::vec_remove_item;

use crate::{
chunk_worker::LoadRequest,
chunk::worker::LoadRequest,
events::{EntityRemoveEvent, ViewUpdateEvent},
Game,
};
Expand Down
4 changes: 4 additions & 0 deletions feather/common/src/chunk/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub mod cache;
pub mod entities;
pub mod loading;
pub mod worker;
File renamed without changes.
2 changes: 1 addition & 1 deletion feather/common/src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use quill_common::{entities::Player, entity_init::EntityInit};

use crate::{
chat::{ChatKind, ChatMessage},
chunk_entities::ChunkEntities,
chunk::entities::ChunkEntities,
events::{BlockChangeEvent, EntityCreateEvent, EntityRemoveEvent, PlayerJoinEvent},
ChatBox, World,
};
Expand Down
12 changes: 3 additions & 9 deletions feather/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,12 @@ pub use window::Window;

pub mod events;

pub mod chunk_worker;
pub mod chunk;
mod region_worker;

pub mod chunk_cache;

pub mod world;
pub use world::World;

mod chunk_loading;

mod chunk_entities;

pub mod chat;
pub use chat::ChatBox;

Expand All @@ -41,8 +35,8 @@ pub mod interactable;
/// Registers gameplay systems with the given `Game` and `SystemExecutor`.
pub fn register(game: &mut Game, systems: &mut SystemExecutor<Game>) {
view::register(game, systems);
chunk_loading::register(game, systems);
chunk_entities::register(systems);
chunk::loading::register(game, systems);
chunk::entities::register(systems);
interactable::register(game);

game.add_entity_spawn_callback(entities::add_entity_components);
Expand Down
2 changes: 1 addition & 1 deletion feather/common/src/region_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use base::anvil::{
};
use flume::{Receiver, Sender};

use crate::chunk_worker::{ChunkLoadResult, LoadRequest, LoadedChunk, SaveRequest, WorkerRequest};
use crate::chunk::worker::{ChunkLoadResult, LoadRequest, LoadedChunk, SaveRequest, WorkerRequest};

/// Duration to keep a region file open when not in use.
const CACHE_TIME: Duration = Duration::from_secs(60);
Expand Down
4 changes: 2 additions & 2 deletions feather/common/src/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use std::{path::PathBuf, sync::Arc};
use worldgen::{ComposableGenerator, WorldGenerator};

use crate::{
chunk_cache::ChunkCache,
chunk_worker::{ChunkWorker, LoadRequest, SaveRequest},
chunk::cache::ChunkCache,
chunk::worker::{ChunkWorker, LoadRequest, SaveRequest},
events::ChunkLoadEvent,
};

Expand Down

0 comments on commit 2039b09

Please sign in to comment.