Bevy 0.16 upgrade (#24)

This commit is contained in:
extrawurst
2025-04-29 00:14:25 +02:00
committed by GitHub
parent b4bfa53df4
commit 11568d57ed
40 changed files with 932 additions and 699 deletions

View File

@@ -103,7 +103,7 @@ fn update_ui(
));
} else {
for entity in query.iter() {
commands.entity(entity).despawn_recursive();
commands.entity(entity).despawn();
}
}
}
@@ -114,8 +114,8 @@ fn update(
(&MainCamera, &mut Transform, &CameraRotationInput),
(Without<CameraTarget>, Without<CameraArmRotation>),
>,
target: Query<&GlobalTransform, (With<CameraTarget>, Without<CameraArmRotation>)>,
arm_rotation: Query<&Transform, With<CameraArmRotation>>,
target: Single<&GlobalTransform, (With<CameraTarget>, Without<CameraArmRotation>)>,
arm_rotation: Single<&Transform, With<CameraArmRotation>>,
spatial_query: SpatialQuery,
cam_state: Res<CameraState>,
) {
@@ -123,15 +123,11 @@ fn update(
return;
}
let Ok(target) = target.get_single().map(|t| t.translation()) else {
return;
};
let target = target.translation();
let Ok(arm_tf) = arm_rotation.get_single() else {
return;
};
let arm_tf = arm_rotation;
let Ok((camera, mut cam_transform, cam_rotation_input)) = cam.get_single_mut() else {
let Ok((camera, mut cam_transform, cam_rotation_input)) = cam.single_mut() else {
return;
};
@@ -159,13 +155,9 @@ fn update(
fn rotate_view(
controls: Res<ControlState>,
mut cam: Query<&mut CameraRotationInput>,
mut cam: Single<&mut CameraRotationInput>,
movement: Res<PlayerMovement>,
) {
let Ok(mut cam) = cam.get_single_mut() else {
return;
};
if !controls.view_mode {
if movement.any_direction {
cam.x = 0.;