From 16ccb4ed5939ea98e38a8e093d116c7ffa35cbd1 Mon Sep 17 00:00:00 2001 From: Peter Hayman Date: Mon, 15 Jul 2024 17:45:45 +1000 Subject: [PATCH] patch --- Cargo.toml | 2 +- crates/beet_ecs/src/observers/mod.rs | 6 +++--- crates/beet_examples/src/lib.rs | 3 --- crates/beet_examples/src/net/mod.rs | 3 --- .../src/plugins/example_default_plugins.rs | 14 +------------- .../{net => plugins}/example_replicate_plugin.rs | 9 +++++++++ crates/beet_examples/src/plugins/mod.rs | 3 +++ 7 files changed, 17 insertions(+), 23 deletions(-) delete mode 100644 crates/beet_examples/src/net/mod.rs rename crates/beet_examples/src/{net => plugins}/example_replicate_plugin.rs (66%) diff --git a/Cargo.toml b/Cargo.toml index ff5511e1..b0bff5eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,7 +96,7 @@ exclude = ["crates/beet_esp"] [workspace.dependencies] ## internal beet = { path = "./", version = "0.0.3-rc.3" } -beet_core = { path = "crates/beet_core", version = "0.0.3-rc.3", default-features = false } +beet_core = { path = "crates/beet_core", version = "0.0.3-rc.3" } beet_ecs = { path = "crates/beet_ecs", version = "0.0.3-rc.3" } beet_ecs_macros = { path = "crates/beet_ecs/macros", version = "0.0.3-rc.3" } beet_ml = { path = "crates/beet_ml", version = "0.0.3-rc.3" } diff --git a/crates/beet_ecs/src/observers/mod.rs b/crates/beet_ecs/src/observers/mod.rs index dd452c43..25731427 100644 --- a/crates/beet_ecs/src/observers/mod.rs +++ b/crates/beet_ecs/src/observers/mod.rs @@ -1,12 +1,12 @@ pub mod action_observer; #[allow(unused_imports)] pub use self::action_observer::*; -pub mod action_observers_builder; -#[allow(unused_imports)] -pub use self::action_observers_builder::*; pub mod action_observer_map; #[allow(unused_imports)] pub use self::action_observer_map::*; +pub mod action_observers_builder; +#[allow(unused_imports)] +pub use self::action_observers_builder::*; pub mod add_observer_hooks; #[allow(unused_imports)] pub use self::add_observer_hooks::*; diff --git a/crates/beet_examples/src/lib.rs b/crates/beet_examples/src/lib.rs index 40717393..95be29d6 100644 --- a/crates/beet_examples/src/lib.rs +++ b/crates/beet_examples/src/lib.rs @@ -1,15 +1,12 @@ // #![allow(unused, dead_code)] pub mod serde_utils; - pub mod components; -pub mod net; pub mod plugins; pub mod scenes; pub mod prelude { pub use crate::components::*; - pub use crate::net::*; pub use crate::plugins::*; pub use crate::scenes; pub use crate::serde_utils::*; diff --git a/crates/beet_examples/src/net/mod.rs b/crates/beet_examples/src/net/mod.rs deleted file mode 100644 index 6de09142..00000000 --- a/crates/beet_examples/src/net/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod example_replicate_plugin; -#[allow(unused_imports)] -pub use self::example_replicate_plugin::*; diff --git a/crates/beet_examples/src/plugins/example_default_plugins.rs b/crates/beet_examples/src/plugins/example_default_plugins.rs index 624c41fb..468d0321 100644 --- a/crates/beet_examples/src/plugins/example_default_plugins.rs +++ b/crates/beet_examples/src/plugins/example_default_plugins.rs @@ -1,6 +1,4 @@ -#[cfg(any(target_arch = "wasm32", feature = "tokio"))] -use crate::beet::prelude::*; -use crate::prelude::load_scenes_from_args; +use crate::prelude::*; use bevy::asset::AssetMetaCheck; use bevy::input::common_conditions::input_toggle_active; use bevy::prelude::*; @@ -13,20 +11,10 @@ use forky_bevy::systems::close_on_esc; #[derive(Default)] pub struct ExampleDefaultPlugins; - -#[cfg(feature = "tokio")] -const DEFAULT_SOCKET_URL: &str = "ws://127.0.0.1:3000/ws"; - impl Plugin for ExampleDefaultPlugins { fn build(&self, app: &mut App) { assert_local_assets(); - #[cfg(target_arch = "wasm32")] - app.add_transport(WebEventClient::new_with_window()); - - #[cfg(feature = "tokio")] - app.add_transport(NativeWsClient::new(DEFAULT_SOCKET_URL).unwrap()); - app.add_plugins(( DefaultPlugins .set(WindowPlugin { diff --git a/crates/beet_examples/src/net/example_replicate_plugin.rs b/crates/beet_examples/src/plugins/example_replicate_plugin.rs similarity index 66% rename from crates/beet_examples/src/net/example_replicate_plugin.rs rename to crates/beet_examples/src/plugins/example_replicate_plugin.rs index 57392956..20ab701e 100644 --- a/crates/beet_examples/src/net/example_replicate_plugin.rs +++ b/crates/beet_examples/src/plugins/example_replicate_plugin.rs @@ -11,6 +11,15 @@ impl Plugin for ExampleReplicatePlugin { .add_event::() .replicate_event_incoming::() /*-*/; + + #[cfg(feature = "tokio")] + const DEFAULT_SOCKET_URL: &str = "ws://127.0.0.1:3000/ws"; + + #[cfg(target_arch = "wasm32")] + app.add_transport(WebEventClient::new_with_window()); + + #[cfg(feature = "tokio")] + app.add_transport(NativeWsClient::new(DEFAULT_SOCKET_URL).unwrap()); } } diff --git a/crates/beet_examples/src/plugins/mod.rs b/crates/beet_examples/src/plugins/mod.rs index cb5e89ab..62afcfb2 100644 --- a/crates/beet_examples/src/plugins/mod.rs +++ b/crates/beet_examples/src/plugins/mod.rs @@ -4,3 +4,6 @@ pub use self::example_default_plugins::*; pub mod example_plugin_group; #[allow(unused_imports)] pub use self::example_plugin_group::*; +pub mod example_replicate_plugin; +#[allow(unused_imports)] +pub use self::example_replicate_plugin::*;