#![no_std]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
use bevy_ecs::component::{Component, ComponentId};
use bevy_reflect::Reflect;
use crate::registry::MessageKind;
use alloc::vec::Vec;
use lightyear_core::network::NetId;
use lightyear_serde::entity_map::RemoteEntityMap;
use lightyear_transport::prelude::Transport;
#[cfg(feature = "client")]
mod client;
pub mod multi;
pub mod plugin;
pub mod receive;
mod receive_event;
pub mod registry;
pub mod send;
mod send_trigger;
#[cfg(feature = "server")]
pub mod server;
mod trigger;
pub mod prelude {
pub use crate::plugin::MessageSystems;
pub use crate::receive::MessageReceiver;
pub use crate::receive_event::RemoteEvent;
pub use crate::registry::{AppMessageExt, MessageRegistry};
pub use crate::send::MessageSender;
pub use crate::send_trigger::EventSender;
pub use crate::trigger::AppTriggerExt;
pub use crate::{Message, MessageManager};
#[cfg(feature = "server")]
pub use crate::server::ServerMultiMessageSender;
}
pub trait Message: Send + Sync + 'static {}
impl<T: Send + Sync + 'static> Message for T {}
pub type MessageNetId = NetId;
#[derive(Component, Default, Reflect)]
#[require(Transport)]
pub struct MessageManager {
pub(crate) send_messages: Vec<(MessageKind, ComponentId)>,
pub(crate) send_triggers: Vec<(MessageKind, ComponentId)>,
pub(crate) receive_messages: Vec<(MessageKind, ComponentId)>,
pub entity_mapper: RemoteEntityMap,
}