Skip to content

Added broadcasting packets with options. And GlobalState Extension trait to easily state.broadcast(&packet, opts).await;#110

Merged
Sweattypalms merged 1 commit into
rewrite/v3from
feature/simple_broadcasting
Nov 1, 2024
Merged

Added broadcasting packets with options. And GlobalState Extension trait to easily state.broadcast(&packet, opts).await;#110
Sweattypalms merged 1 commit into
rewrite/v3from
feature/simple_broadcasting

Conversation

@Sweattypalms
Copy link
Copy Markdown
Member

Better broadcasting. You can simply do state.broadcast(&packet, options); and it broadcasts to either: All entities, or specifically the entities mentioned with the BroadcastOptions::default().only(entities);. Can also have both Sync and Async callbacks using

BroadcastOptions::default().with_async_callback(|entity, state| async move {
// do whatever
});

Or for Sync callbaks

BroadcastOptions::default().with_sync_callback(move |entity, state| {
// do whatever
});

…ait to easily `state.broadcast(&packet, opts).await;`
@Sweattypalms Sweattypalms merged commit e232468 into rewrite/v3 Nov 1, 2024
@ReCore-sys ReCore-sys deleted the feature/simple_broadcasting branch December 1, 2024 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant