Trait ambient_api::prelude::ModuleMessage
source · pub trait ModuleMessage: Message {
// Provided methods
fn send(&self, target: Target) { ... }
fn send_local_broadcast(&self, include_self: bool) { ... }
fn send_local(&self, target_id: EntityId) { ... }
fn send_server_unreliable(&self) { ... }
fn send_server_reliable(&self) { ... }
fn send_client_broadcast_unreliable(&self) { ... }
fn send_client_broadcast_reliable(&self) { ... }
fn send_client_targeted_unreliable(&self, user_id: String) { ... }
fn send_client_targeted_reliable(&self, user_id: String) { ... }
fn subscribe<R>(
callback: impl FnMut(MessageContext, Self) -> R + 'static
) -> Listener
where R: CallbackReturn { ... }
}
Expand description
Implemented by all messages that can be sent between modules.
Provided Methods§
sourcefn send(&self, target: Target)
fn send(&self, target: Target)
Sends this Message to target
. Wrapper around self::send.
sourcefn send_local_broadcast(&self, include_self: bool)
fn send_local_broadcast(&self, include_self: bool)
Sends a message to every package on this side.
include_self
controls whether or not the message is sent to the package that originally sent the message.
sourcefn send_local(&self, target_id: EntityId)
fn send_local(&self, target_id: EntityId)
Sends a message to a specific package or module on this side.
sourcefn send_server_unreliable(&self)
fn send_server_unreliable(&self)
client
only.Sends an unreliable message to the server.
Note that this message will only be received by the corresponding package on the server, and not by any other packages. You will need to explicitly relay the message to other packages on the server.
See Target::ServerUnreliable for details.
sourcefn send_server_reliable(&self)
fn send_server_reliable(&self)
client
only.Sends a reliable message to the server.
Note that this message will only be received by the corresponding package on the server, and not by any other packages. You will need to explicitly relay the message to other packages on the server.
See Target::ServerReliable for details.
sourcefn send_client_broadcast_unreliable(&self)
fn send_client_broadcast_unreliable(&self)
server
only.Sends an unreliable message to all clients.
Note that this message will only be received by the corresponding package on the client, and not by any other packages. You will need to explicitly relay the message to other packages on the client.
See Target::ClientBroadcastUnreliable for details.
sourcefn send_client_broadcast_reliable(&self)
fn send_client_broadcast_reliable(&self)
server
only.Sends a reliable message to all clients.
Note that this message will only be received by the corresponding package on the client, and not by any other packages. You will need to explicitly relay the message to other packages on the client.
See Target::ClientBroadcastReliable for details.
sourcefn send_client_targeted_unreliable(&self, user_id: String)
fn send_client_targeted_unreliable(&self, user_id: String)
server
only.Sends an unreliable message to a specific client.
Note that this message will only be received by the corresponding package on the client, and not by any other packages. You will need to explicitly relay the message to other packages on the client.
See Target::ClientTargetedUnreliable for details.
sourcefn send_client_targeted_reliable(&self, user_id: String)
fn send_client_targeted_reliable(&self, user_id: String)
server
only.Sends a reliable message to a specific client.
Note that this message will only be received by the corresponding package on the client, and not by any other packages. You will need to explicitly relay the message to other packages on the client.
See Target::ClientTargetedReliable for details.
sourcefn subscribe<R>(
callback: impl FnMut(MessageContext, Self) -> R + 'static
) -> Listenerwhere
R: CallbackReturn,
fn subscribe<R>(
callback: impl FnMut(MessageContext, Self) -> R + 'static
) -> Listenerwhere
R: CallbackReturn,
Subscribes to this Message. Wrapper around self::subscribe.