44#[ cfg( feature = "multi-quadtree" ) ]
55mod multi_plugin;
66
7- #[ cfg( feature = "multi-quadtree" ) ]
8- pub use multi_plugin:: {
9- AsQuadTreePluginConfig , MultiQuadTreePlugin , QTConfig , QuadTreePluginConfig ,
10- } ;
11-
127use crate :: collision:: { AsDynCollision , UpdateCollision } ;
138use crate :: system:: { update_collision, update_quadtree} ;
149use crate :: tree:: QuadTree ;
1510use bevy_app:: prelude:: * ;
11+ use bevy_ecs:: component:: Mutable ;
1612use bevy_ecs:: prelude:: * ;
17- use bevy_ecs:: schedule:: { IntoSystemConfigs , SystemConfigs } ;
13+ use bevy_ecs:: schedule:: ScheduleConfigs ;
14+ use bevy_ecs:: system:: ScheduleSystem ;
1815#[ cfg( feature = "sprite" ) ]
1916use bevy_sprite:: Sprite ;
2017use bevy_transform:: prelude:: * ;
18+ #[ cfg( feature = "multi-quadtree" ) ]
19+ pub use multi_plugin:: {
20+ AsQuadTreePluginConfig , MultiQuadTreePlugin , QTConfig , QuadTreePluginConfig ,
21+ } ;
2122
2223/// A Bevy plugin for quadtree.
2324/// # Type Parameters
@@ -92,16 +93,16 @@ pub struct QuadTreePlugin<
9293}
9394
9495impl <
95- P ,
96- const D : usize ,
97- const N : usize ,
98- const W : usize ,
99- const H : usize ,
100- const X : usize ,
101- const Y : usize ,
102- const K : usize ,
103- const ID : usize ,
104- > Default for QuadTreePlugin < P , N , D , W , H , X , Y , K , ID >
96+ P ,
97+ const D : usize ,
98+ const N : usize ,
99+ const W : usize ,
100+ const H : usize ,
101+ const X : usize ,
102+ const Y : usize ,
103+ const K : usize ,
104+ const ID : usize ,
105+ > Default for QuadTreePlugin < P , N , D , W , H , X , Y , K , ID >
105106where
106107 P : TrackingPair ,
107108{
@@ -113,16 +114,16 @@ where
113114}
114115
115116impl <
116- P ,
117- const N : usize ,
118- const D : usize ,
119- const W : usize ,
120- const H : usize ,
121- const X : usize ,
122- const Y : usize ,
123- const K : usize ,
124- const ID : usize ,
125- > Plugin for QuadTreePlugin < P , N , D , W , H , X , Y , K , ID >
117+ P ,
118+ const N : usize ,
119+ const D : usize ,
120+ const W : usize ,
121+ const H : usize ,
122+ const X : usize ,
123+ const Y : usize ,
124+ const K : usize ,
125+ const ID : usize ,
126+ > Plugin for QuadTreePlugin < P , N , D , W , H , X , Y , K , ID >
126127where
127128 P : TrackingPair ,
128129{
@@ -144,12 +145,12 @@ where
144145/// Also implemented for tuple of `(S, C)` pairs.
145146pub trait TrackingPair : Send + Sync + ' static {
146147 /// return the system to update collision
147- fn update_collision ( ) -> SystemConfigs ;
148+ fn update_collision ( ) -> ScheduleConfigs < ScheduleSystem > ;
148149 /// return the system to update quadtree
149- fn update_quadtree < const ID : usize > ( ) -> SystemConfigs ;
150+ fn update_quadtree < const ID : usize > ( ) -> ScheduleConfigs < ScheduleSystem > ;
150151 /// return the system to show box
151152 #[ cfg( feature = "gizmos" ) ]
152- fn show_boundary < const ID : usize > ( ) -> SystemConfigs ;
153+ fn show_boundary < const ID : usize > ( ) -> ScheduleConfigs < ScheduleSystem > ;
153154 /// return the shape id, to ensure no duplicate shape updating system added
154155 #[ cfg( debug_assertions) ]
155156 fn shape_id ( ) -> std:: any:: TypeId ;
@@ -159,16 +160,16 @@ macro_rules! impl_tracking_pair {
159160 ( $c: ty) => {
160161 impl <S > TrackingPair for ( S , $c)
161162 where
162- S : Component + AsDynCollision + UpdateCollision <$c> + Clone ,
163+ S : Component < Mutability = Mutable > + AsDynCollision + UpdateCollision <$c> + Clone ,
163164 {
164- fn update_collision( ) -> SystemConfigs {
165+ fn update_collision( ) -> ScheduleConfigs < ScheduleSystem > {
165166 update_collision:: <S , $c>. ambiguous_with_all( )
166167 }
167- fn update_quadtree<const ID : usize >( ) -> SystemConfigs {
168+ fn update_quadtree<const ID : usize >( ) -> ScheduleConfigs < ScheduleSystem > {
168169 update_quadtree:: <S , ID >. ambiguous_with_all( )
169170 }
170171 #[ cfg( feature = "gizmos" ) ]
171- fn show_boundary<const ID : usize >( ) -> SystemConfigs {
172+ fn show_boundary<const ID : usize >( ) -> ScheduleConfigs < ScheduleSystem > {
172173 use crate :: system:: show_boundary;
173174 show_boundary:: <S , ID >. ambiguous_with_all( )
174175 }
@@ -188,19 +189,19 @@ macro_rules! impl_tracking_pair_tuple {
188189 ( $( $c: ty) ,+) => {
189190 impl <S > TrackingPair for ( S , ( $( $c) ,+, ) )
190191 where
191- S : Component + AsDynCollision + $( UpdateCollision <$c>+) + Clone ,
192+ S : Component < Mutability = Mutable > + AsDynCollision + $( UpdateCollision <$c>+) + Clone ,
192193 {
193- fn update_collision( ) -> SystemConfigs {
194+ fn update_collision( ) -> ScheduleConfigs < ScheduleSystem > {
194195 // update_collision has Mut<S>, so chain them
195196 ( $( update_collision:: <S , $c>) ,+, ) . chain( )
196197 }
197198 fn update_quadtree<const ID : usize >(
198- ) -> SystemConfigs {
199+ ) -> ScheduleConfigs < ScheduleSystem > {
199200 update_quadtree:: <S , ID >. ambiguous_with_all( )
200201 }
201202 #[ cfg( feature = "gizmos" ) ]
202203 fn show_boundary<const ID : usize >(
203- ) -> SystemConfigs {
204+ ) -> ScheduleConfigs < ScheduleSystem > {
204205 use crate :: system:: show_boundary;
205206 show_boundary:: <S , ID >. ambiguous_with_all( )
206207 }
@@ -227,12 +228,12 @@ macro_rules! impl_tracking_pairs {
227228 where
228229 $( [ <P $i>] : TrackingPair ) ,+
229230 {
230- fn update_collision( ) -> SystemConfigs {
231+ fn update_collision( ) -> ScheduleConfigs < ScheduleSystem > {
231232 // no duplicate shape in `P`s, so ambiguous_with_all
232233 ( $( [ <P $i>] :: update_collision( ) ) ,+, ) . ambiguous_with_all( )
233234 }
234235 fn update_quadtree<const ID : usize >(
235- ) -> SystemConfigs {
236+ ) -> ScheduleConfigs < ScheduleSystem > {
236237 #[ cfg( debug_assertions) ]
237238 {
238239 let mut set = std:: collections:: HashMap :: new( ) ;
@@ -246,7 +247,7 @@ macro_rules! impl_tracking_pairs {
246247 }
247248 #[ cfg( feature = "gizmos" ) ]
248249 fn show_boundary<const ID : usize >(
249- ) -> SystemConfigs {
250+ ) -> ScheduleConfigs < ScheduleSystem > {
250251 #[ cfg( debug_assertions) ]
251252 {
252253 let mut set = std:: collections:: HashMap :: new( ) ;
0 commit comments