Skip to content

Commit

Permalink
Explicit schedule ordering (0.4.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Veritius committed Mar 21, 2024
1 parent 4995d6d commit 006fa3d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stardust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name="bevy_stardust"
version="0.4.0"
version="0.4.1"
edition="2021"
authors=["Veritius <veritiusgaming@gmail.com>"]
readme="../README.md"
Expand Down
3 changes: 3 additions & 0 deletions stardust/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ impl Plugin for StardustPlugin {
crate::messages::systems::clear_message_queue_system::<Incoming>,
).in_set(NetworkWrite::Clear));

// Setup orderings
crate::scheduling::configure_scheduling(app);

// Hashing-related functionality
#[cfg(feature="hashing")] {
use crate::hashing::*;
Expand Down
11 changes: 11 additions & 0 deletions stardust/src/scheduling.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Schedules used in Stardust.
use bevy_ecs::prelude::*;
use bevy_app::prelude::*;

/// Systems dealing with incoming octet strings. Run in the `PreUpdate` schedule.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, SystemSet)]
Expand All @@ -19,4 +20,14 @@ pub enum NetworkWrite {
Send,
/// Queued messages (both the incoming and outgoing buffers) are cleared.
Clear,
}

pub(super) fn configure_scheduling(app: &mut App) {
app.configure_sets(PreUpdate, (
NetworkRead::Read.after(NetworkRead::Receive),
));

app.configure_sets(PostUpdate, (
NetworkWrite::Clear.after(NetworkWrite::Send),
));
}

0 comments on commit 006fa3d

Please sign in to comment.