@@ -298,7 +298,10 @@ pub struct Island;
298
298
299
299
/// An asset holding a `landmass` nav mesh.
300
300
#[ derive( Asset , TypePath ) ]
301
- pub struct NavMesh < CS : CoordinateSystem > ( pub Arc < ValidNavigationMesh < CS > > ) ;
301
+ pub struct NavMesh < CS : CoordinateSystem > {
302
+ pub nav_mesh : Arc < ValidNavigationMesh < CS > > ,
303
+ // This can't be a tuple struct due to https://github.com/rust-lang/rust/issues/73191
304
+ }
302
305
303
306
pub type NavMesh2d = NavMesh < TwoD > ;
304
307
pub type NavMesh3d = NavMesh < ThreeD > ;
@@ -412,13 +415,13 @@ fn sync_island_nav_mesh<CS: CoordinateSystem>(
412
415
None => true ,
413
416
Some ( ( current_transform, current_nav_mesh) ) => {
414
417
current_transform != & island_transform
415
- || !Arc :: ptr_eq ( & current_nav_mesh, & island_nav_mesh. 0 )
418
+ || !Arc :: ptr_eq ( & current_nav_mesh, & island_nav_mesh. nav_mesh )
416
419
}
417
420
} ;
418
421
419
422
if set_nav_mesh {
420
423
landmass_island
421
- . set_nav_mesh ( island_transform, Arc :: clone ( & island_nav_mesh. 0 ) ) ;
424
+ . set_nav_mesh ( island_transform, Arc :: clone ( & island_nav_mesh. nav_mesh ) ) ;
422
425
}
423
426
}
424
427
}
@@ -458,14 +461,17 @@ impl<CS: CoordinateSystem> ArchipelagoRef<CS> {
458
461
/// The current velocity of the agent/character. This must be set to match
459
462
/// whatever speed the agent/character is going.
460
463
#[ derive( Component ) ]
461
- pub struct Velocity < CS : CoordinateSystem > ( pub CS :: Coordinate ) ;
464
+ pub struct Velocity < CS : CoordinateSystem > {
465
+ pub velocity : CS :: Coordinate ,
466
+ // This can't be a tuple struct due to https://github.com/rust-lang/rust/issues/73191
467
+ }
462
468
463
469
pub type Velocity2d = Velocity < TwoD > ;
464
470
pub type Velocity3d = Velocity < ThreeD > ;
465
471
466
472
impl < CS : CoordinateSystem > Default for Velocity < CS > {
467
473
fn default ( ) -> Self {
468
- Self ( Default :: default ( ) )
474
+ Self { velocity : Default :: default ( ) }
469
475
}
470
476
}
471
477
@@ -617,7 +623,7 @@ fn sync_agent_input_state<CS: CoordinateSystem>(
617
623
let landmass_agent = archipelago. get_agent_mut ( agent_entity) ;
618
624
landmass_agent. position =
619
625
CS :: from_transform_position ( transform. translation ( ) ) ;
620
- if let Some ( Velocity ( velocity) ) = velocity {
626
+ if let Some ( Velocity { velocity } ) = velocity {
621
627
landmass_agent. velocity = velocity. clone ( ) ;
622
628
}
623
629
landmass_agent. radius = agent. radius ;
@@ -746,7 +752,8 @@ fn sync_character_state<CS: CoordinateSystem>(
746
752
let landmass_character = archipelago. get_character_mut ( character_entity) ;
747
753
landmass_character. position =
748
754
CS :: from_transform_position ( transform. translation ( ) ) ;
749
- landmass_character. velocity = if let Some ( Velocity ( velocity) ) = velocity {
755
+ landmass_character. velocity = if let Some ( Velocity { velocity } ) = velocity
756
+ {
750
757
velocity. clone ( )
751
758
} else {
752
759
CS :: Coordinate :: default ( )
0 commit comments