Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose BRP system scheduling and add system set #16400

Merged
merged 2 commits into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions crates/bevy_remote/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ use bevy_app::{prelude::*, MainScheduleOrder};
use bevy_derive::{Deref, DerefMut};
use bevy_ecs::{
entity::Entity,
schedule::{IntoSystemConfigs, ScheduleLabel},
schedule::{IntoSystemConfigs, IntoSystemSetConfigs, ScheduleLabel, SystemSet},
system::{Commands, In, IntoSystem, ResMut, Resource, System, SystemId},
world::World,
};
Expand Down Expand Up @@ -442,21 +442,36 @@ impl Plugin for RemotePlugin {
app.insert_resource(remote_methods)
.init_resource::<RemoteWatchingRequests>()
.add_systems(PreStartup, setup_mailbox_channel)
.configure_sets(
RemoteLast,
(RemoteSet::ProcessRequests, RemoteSet::Cleanup).chain(),
)
.add_systems(
RemoteLast,
(
process_remote_requests,
process_ongoing_watching_requests,
remove_closed_watching_requests,
)
.chain(),
(process_remote_requests, process_ongoing_watching_requests)
.chain()
.in_set(RemoteSet::ProcessRequests),
remove_closed_watching_requests.in_set(RemoteSet::Cleanup),
),
);
}
}

/// Schedule that contains all systems to process Bevy Remote Protocol requests
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
struct RemoteLast;
pub struct RemoteLast;

/// The systems sets of the [`RemoteLast`] schedule.
///
/// These can be useful for ordering.
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
pub enum RemoteSet {
/// Processing of remote requests.
ProcessRequests,
/// Cleanup (remove closed watchers etc)
Cleanup,
}

/// A type to hold the allowed types of systems to be used as method handlers.
#[derive(Debug)]
Expand Down