From 462d6c5aaa2281bf875e04d5e2c3241a13256836 Mon Sep 17 00:00:00 2001 From: Silas Bartha Date: Mon, 17 Jun 2024 19:37:21 -0400 Subject: Mon Jun 17 07:37:21 PM EDT 2024 --- src/components.rs | 6 ++++++ src/lib.rs | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') 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::() .init_resource::(); } -- cgit v1.2.3