aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components.rs6
-rw-r--r--src/lib.rs7
2 files changed, 12 insertions, 1 deletions
diff --git a/src/components.rs b/src/components.rs
index 69a5cde..bea87f2 100644
--- a/src/components.rs
+++ b/src/components.rs
@@ -1,5 +1,11 @@
+use std::path::PathBuf;
+
use bevy::prelude::*;
/// A tooltip on an object, which can be displayed.
#[derive(Component)]
pub struct Tooltip(pub String);
+
+/// A marker component for entities spawned by dirworld handlers, i.e. they should be removed when the room changes.
+#[derive(Component)]
+pub struct DirworldEntity(pub PathBuf);
diff --git a/src/lib.rs b/src/lib.rs
index 6b46502..f4bd783 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,7 +4,7 @@
use std::path::PathBuf;
-use bevy::prelude::*;
+use bevy::{asset::io::AssetSource, prelude::*};
use events::DirworldNavigationEvent;
use resources::{Dirworld, DirworldConfig};
@@ -25,7 +25,12 @@ pub struct DirworldPlugin {
impl Plugin for DirworldPlugin {
fn build(&self, app: &mut App) {
+ info!("building");
+ let path_string = self.path.to_string_lossy().to_string();
app.insert_resource(DirworldConfig::new(self.path.clone()))
+ .register_asset_source("dirworld", AssetSource::build()
+ .with_reader(AssetSource::get_default_reader(path_string.clone()))
+ .with_watcher(|_| None))
.add_event::<DirworldNavigationEvent>()
.init_resource::<Dirworld>();
}