aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar Silas Bartha <silas@exvacuum.dev>2024-11-21 12:17:44 -0500
committerLibravatar Silas Bartha <silas@exvacuum.dev>2024-11-21 12:17:44 -0500
commit26e2eddd1efeb0a5fff8ffabebefdae48c4a65dc (patch)
tree7f0903a6c90fb4e09d2894f55cffd0acbcb51350 /src/lib.rs
parent99c398cc127dbc83480f98fea8c76f7c19d4dce8 (diff)
Thu Nov 21 12:17:44 PM EST 2024
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs78
1 files changed, 50 insertions, 28 deletions
diff --git a/src/lib.rs b/src/lib.rs
index cf56ccf..e6a5f25 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,9 +4,14 @@
use std::{ffi::OsStr, path::PathBuf};
+use actor::ActorPlugin;
+use bevy::render::mesh::ExtrusionBuilder;
use bevy::{ecs::system::IntoObserverSystem, prelude::*};
use bevy_scriptum::{runtimes::lua::LuaRuntime, BuildScriptingRuntime, ScriptingRuntimeBuilder};
-use events::{DirworldChangeRoot, DirworldEnterRoom, DirworldLeaveRoom, DirworldNavigationEvent, DirworldSpawn};
+use events::{
+ DirworldChangeRoot, DirworldEnterRoom, DirworldLeaveRoom, DirworldNavigationEvent,
+ DirworldSpawn,
+};
use occule::Codec;
use resources::DirworldCache;
use resources::{
@@ -15,6 +20,7 @@ use resources::{
};
pub use watcher::DirworldWatcherEvent;
pub use watcher::DirworldWatcherSet;
+use yarnspinner::core::Library;
/// Components used by this plugin
pub mod components;
@@ -34,7 +40,7 @@ mod systems;
mod observers;
-mod utils;
+pub mod utils;
/// Payload for dirworld entities
pub mod payload;
@@ -44,6 +50,12 @@ pub mod actor;
mod lua_api;
+pub mod conditionals;
+
+pub mod yarnspinner_api;
+
+pub mod room_generation;
+
/// Plugin which enables high-level interaction
#[derive(Default)]
pub struct DirworldPlugin {
@@ -54,32 +66,42 @@ pub struct DirworldPlugin {
impl Plugin for DirworldPlugin {
fn build(&self, app: &mut App) {
info!("building");
- app.add_systems(Startup, watcher::setup)
- .add_systems(
- Update,
- (systems::remove_completed_tasks, lua_api::trigger_update),
- )
- .add_systems(PostUpdate, (watcher::update, systems::sync_entity_transforms))
- .add_scripting::<LuaRuntime>(|runtime| {
- let runtime = lua_api::register(runtime);
- if let Some(register_custom) = &self.register_custom_lua_api {
- (register_custom)(runtime);
- }
- })
- .init_resource::<DirworldCache>()
- .init_resource::<DirworldRootDir>()
- .init_resource::<DirworldCurrentDir>()
- .init_resource::<DirworldTasks>()
- .init_resource::<DirworldObservers>()
- .init_resource::<DirworldCodecs>()
- .add_event::<DirworldEnterRoom>()
- .add_event::<DirworldLeaveRoom>()
- .add_event::<DirworldChangeRoot>()
- .add_event::<DirworldWatcherEvent>()
- .observe(observers::navigate_to_room)
- .observe(observers::handle_changes)
- .observe(observers::change_root)
- .observe(observers::navigate_from_room);
+ app.add_plugins(ActorPlugin {
+ custom_function_registration: Some(yarnspinner_api::setup_yarnspinner_functions),
+ })
+ .add_systems(Startup, watcher::setup)
+ .add_systems(
+ Update,
+ (
+ systems::remove_completed_tasks,
+ lua_api::trigger_update,
+ yarnspinner_api::process_commands,
+ ),
+ )
+ .add_systems(
+ PostUpdate,
+ watcher::update,
+ )
+ .add_scripting::<LuaRuntime>(|runtime| {
+ let runtime = lua_api::register(runtime);
+ if let Some(register_custom) = &self.register_custom_lua_api {
+ (register_custom)(runtime);
+ }
+ })
+ .init_resource::<DirworldCache>()
+ .init_resource::<DirworldRootDir>()
+ .init_resource::<DirworldCurrentDir>()
+ .init_resource::<DirworldTasks>()
+ .init_resource::<DirworldObservers>()
+ .init_resource::<DirworldCodecs>()
+ .add_event::<DirworldEnterRoom>()
+ .add_event::<DirworldLeaveRoom>()
+ .add_event::<DirworldChangeRoot>()
+ .add_event::<DirworldWatcherEvent>()
+ .observe(observers::navigate_to_room)
+ .observe(observers::handle_changes)
+ .observe(observers::change_root)
+ .observe(observers::navigate_from_room);
}
}