diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-02-26 15:07:52 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-26 15:07:52 -0600 |
| commit | cbc6af81fbdee71f4c1c7d62e1b91f8b17ad23bd (patch) | |
| tree | eb9c19c4b5e3489a8ff1fd304c49d051f18c35d9 /azalea-ecs | |
| parent | c1588ef66e844c067112ea880a54b4de9ec5a062 (diff) | |
| download | azalea-drasl-cbc6af81fbdee71f4c1c7d62e1b91f8b17ad23bd.tar.xz | |
Add PacketEvent (#75)
* add PacketEvent
* docs and fixes
* Event::Packet works
Diffstat (limited to 'azalea-ecs')
| -rw-r--r-- | azalea-ecs/azalea-ecs-macros/src/component.rs | 4 | ||||
| -rwxr-xr-x | azalea-ecs/azalea-ecs-macros/src/lib.rs | 10 | ||||
| -rw-r--r-- | azalea-ecs/azalea-ecs-macros/src/utils/mod.rs | 3 | ||||
| -rw-r--r-- | azalea-ecs/src/lib.rs | 19 |
4 files changed, 25 insertions, 11 deletions
diff --git a/azalea-ecs/azalea-ecs-macros/src/component.rs b/azalea-ecs/azalea-ecs-macros/src/component.rs index 306b64de..e076bbe1 100644 --- a/azalea-ecs/azalea-ecs-macros/src/component.rs +++ b/azalea-ecs/azalea-ecs-macros/src/component.rs @@ -19,7 +19,7 @@ pub fn derive_resource(input: TokenStream) -> TokenStream { let (impl_generics, type_generics, where_clause) = &ast.generics.split_for_impl(); TokenStream::from(quote! { - impl #impl_generics #azalea_ecs_path::system::BevyResource for #struct_name #type_generics #where_clause { + impl #impl_generics #azalea_ecs_path::system::_BevyResource for #struct_name #type_generics #where_clause { } }) } @@ -44,7 +44,7 @@ pub fn derive_component(input: TokenStream) -> TokenStream { let (impl_generics, type_generics, where_clause) = &ast.generics.split_for_impl(); TokenStream::from(quote! { - impl #impl_generics #azalea_ecs_path::component::BevyComponent for #struct_name #type_generics #where_clause { + impl #impl_generics #azalea_ecs_path::component::_BevyComponent for #struct_name #type_generics #where_clause { type Storage = #storage; } }) diff --git a/azalea-ecs/azalea-ecs-macros/src/lib.rs b/azalea-ecs/azalea-ecs-macros/src/lib.rs index 09ccb094..9d4e9b2d 100755 --- a/azalea-ecs/azalea-ecs-macros/src/lib.rs +++ b/azalea-ecs/azalea-ecs-macros/src/lib.rs @@ -151,13 +151,13 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream { match field_kind { BundleFieldKind::Component => { field_component_ids.push(quote! { - <#field_type as #ecs_path::bundle::BevyBundle>::component_ids(components, storages, &mut *ids); + <#field_type as #ecs_path::bundle::_BevyBundle>::component_ids(components, storages, &mut *ids); }); field_get_components.push(quote! { self.#field.get_components(&mut *func); }); field_from_components.push(quote! { - #field: <#field_type as #ecs_path::bundle::BevyBundle>::from_components(ctx, &mut *func), + #field: <#field_type as #ecs_path::bundle::_BevyBundle>::from_components(ctx, &mut *func), }); } @@ -174,7 +174,7 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream { TokenStream::from(quote! { /// SAFETY: ComponentId is returned in field-definition-order. [from_components] and [get_components] use field-definition-order - unsafe impl #impl_generics #ecs_path::bundle::BevyBundle for #struct_name #ty_generics #where_clause { + unsafe impl #impl_generics #ecs_path::bundle::_BevyBundle for #struct_name #ty_generics #where_clause { fn component_ids( components: &mut #ecs_path::component::Components, storages: &mut #ecs_path::storage::Storages, @@ -488,7 +488,9 @@ pub fn derive_stage_label(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); let mut trait_path = azalea_ecs_path(); trait_path.segments.push(format_ident!("schedule").into()); - trait_path.segments.push(format_ident!("StageLabel").into()); + trait_path + .segments + .push(format_ident!("_BevyStageLabel").into()); derive_label(input, &trait_path, "stage_label") } diff --git a/azalea-ecs/azalea-ecs-macros/src/utils/mod.rs b/azalea-ecs/azalea-ecs-macros/src/utils/mod.rs index 5fbba0e9..c79e3efe 100644 --- a/azalea-ecs/azalea-ecs-macros/src/utils/mod.rs +++ b/azalea-ecs/azalea-ecs-macros/src/utils/mod.rs @@ -38,6 +38,7 @@ impl Default for BevyManifest { impl BevyManifest { pub fn maybe_get_path(&self, name: &str) -> Option<syn::Path> { const AZALEA: &str = "azalea"; + const AZALEA_ECS: &str = "azalea_ecs"; const BEVY_ECS: &str = "bevy_ecs"; const BEVY: &str = "bevy"; @@ -57,6 +58,8 @@ impl BevyManifest { return Some(Self::parse_str(dep_package(dep).unwrap_or(name))); } else if let Some(dep) = deps.get(AZALEA) { dep_package(dep).unwrap_or(AZALEA) + } else if let Some(dep) = deps.get(AZALEA_ECS) { + dep_package(dep).unwrap_or(AZALEA_ECS) } else if let Some(dep) = deps.get(BEVY_ECS) { dep_package(dep).unwrap_or(BEVY_ECS) } else if let Some(dep) = deps.get(BEVY) { diff --git a/azalea-ecs/src/lib.rs b/azalea-ecs/src/lib.rs index 571bd741..bc374e45 100644 --- a/azalea-ecs/src/lib.rs +++ b/azalea-ecs/src/lib.rs @@ -29,14 +29,14 @@ pub mod component { // we do this because re-exporting Component would re-export the macro as well, // which is bad (since we have our own Component macro) // instead, we have to do this so Component is a trait alias and the original - // impl-able trait is still available as BevyComponent + // impl-able trait is still available as _BevyComponent pub trait Component = bevy_ecs::component::Component; - pub use bevy_ecs::component::Component as BevyComponent; + pub use bevy_ecs::component::Component as _BevyComponent; } pub mod bundle { pub use azalea_ecs_macros::Bundle; pub trait Bundle = bevy_ecs::bundle::Bundle; - pub use bevy_ecs::bundle::Bundle as BevyBundle; + pub use bevy_ecs::bundle::Bundle as _BevyBundle; } pub mod system { pub use azalea_ecs_macros::Resource; @@ -44,10 +44,19 @@ pub mod system { Command, Commands, EntityCommands, Query, Res, ResMut, SystemState, }; pub trait Resource = bevy_ecs::system::Resource; - pub use bevy_ecs::system::Resource as BevyResource; + pub use bevy_ecs::system::Resource as _BevyResource; +} +pub mod schedule { + pub use azalea_ecs_macros::StageLabel; + pub use bevy_ecs::schedule::{ + IntoRunCriteria, IntoSystemDescriptor, ReportExecutionOrderAmbiguities, Schedule, Stage, + SystemSet, SystemStage, + }; + pub trait StageLabel = bevy_ecs::schedule::StageLabel; + pub use bevy_ecs::schedule::StageLabel as _BevyStageLabel; } pub use bevy_app as app; -pub use bevy_ecs::{entity, event, ptr, query, schedule, storage}; +pub use bevy_ecs::{entity, event, ptr, query, storage}; use app::{App, CoreStage, Plugin}; use bevy_ecs::schedule::*; |
