-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Configurable systems/event clearing #34
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, similar to Rapier but with systems instead of stages (makes sense).
bevy_renet/src/lib.rs
Outdated
@@ -70,11 +121,32 @@ impl RenetClientPlugin { | |||
} | |||
} | |||
|
|||
pub fn send_packets_system(mut client: ResMut<RenetClient>, mut renet_error: EventWriter<RenetError>) { | |||
pub fn send_packets(mut client: ResMut<RenetClient>, mut renet_error: EventWriter<RenetError>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using _system
is a convention suggested by @cart
. Also other systems still have _system
suffix, so I would keep it.
bevy_renet/src/lib.rs
Outdated
pub fn get_systems(label: RenetSystems) -> SystemSet { | ||
match label { | ||
RenetSystems::ClearEvents => SystemSet::new() | ||
.with_system(Events::<ServerEvent>::update_system) | ||
.with_system(Events::<RenetError>::update_system) | ||
.label(RenetSystems::ClearEvents), | ||
RenetSystems::Update => SystemSet::new() | ||
.with_system(Self::update_system.with_run_criteria(has_resource::<RenetServer>)) | ||
.label(RenetSystems::Update), | ||
RenetSystems::SendPackets => SystemSet::new().with_system( | ||
Self::send_packets | ||
.with_run_criteria(has_resource::<RenetServer>) | ||
.label(RenetSystems::SendPackets), | ||
), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that adding systems like this adds too much noise to the code without gains, we have very few system, the labels almost map 1 to 1. I think we still could use the old way, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya I was just thinking it might be useful if more systems are added in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the time comes, we can use this approach if necessary 👍
For now, I would just use after/before the system names and remove the get_system
.
But I can see why rapier is using it, they have a way more complex system structure and ordering.
Thanks! Sorry for the delay |
@lucaspoffo variable |
Related issue: #31
Somewhat follows bevy_rapier's example although I don't make entire stages since that seems a bit wasteful here. But this should also make it easier to add more systems without breakage in the future if needed.