diff options
Diffstat (limited to 'src/resources.rs')
-rw-r--r-- | src/resources.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/resources.rs b/src/resources.rs index cbf570d..bf0c072 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -1,9 +1,8 @@ -use std::{collections::{BTreeMap, HashMap}, path::PathBuf}; +use std::{collections::BTreeMap, path::PathBuf}; use bevy::{ecs::world::CommandQueue, prelude::*, tasks::Task}; use multi_key_map::MultiKeyMap; use occule::Codec; -use uuid::Uuid; use crate::payload::DirworldEntityPayload; @@ -14,7 +13,9 @@ pub struct DirworldRootDir(pub Option<PathBuf>); /// Current directory of the world #[derive(Resource, Default)] pub struct DirworldCurrentDir{ + /// Path of current directory pub path: PathBuf, + /// Payload (contents of .door file) in current directory, if present pub payload: Option<DirworldEntityPayload>, } @@ -22,18 +23,20 @@ pub struct DirworldCurrentDir{ #[derive(Default, Resource, Deref, DerefMut)] pub struct DirworldTasks(pub BTreeMap<String, Task<Option<CommandQueue>>>); +/// A map between file types and their corresponding preload/spawn callback observers #[derive(Debug, Default, Resource, Deref, DerefMut)] pub struct DirworldObservers(pub MultiKeyMap<EntryType, Entity>); +/// A map between file extensions and their corresponding [`Codec`]s #[derive(Default, Resource, Deref, DerefMut)] pub struct DirworldCodecs(pub MultiKeyMap<String, Box<dyn Codec + Send + Sync>>); +/// Type of a filesystem entry #[derive(Debug, PartialEq, Eq, Hash)] pub enum EntryType { + /// A file with an optional extension File(Option<String>), + /// A folder Folder, } -/// Structure containing payload data for cached (non-current) rooms -#[derive(Resource, Default, Debug, Deref, DerefMut)] -pub struct DirworldCache(pub HashMap<PathBuf, DirworldEntityPayload>); |