Switch off deprecated functions, fix clippy lints
This commit is contained in:
@@ -171,7 +171,7 @@ fn check_keyboard(
|
|||||||
dir.y += 1.0;
|
dir.y += 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
**pvelocity = **pvelocity + dir.extend(0.0);
|
**pvelocity += dir.extend(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cohesion(
|
fn cohesion(
|
||||||
@@ -231,7 +231,7 @@ fn alignment(
|
|||||||
let neighbors = spatial_tree.within_distance(transform.translation.xy(), BOID_VIEW_RANGE);
|
let neighbors = spatial_tree.within_distance(transform.translation.xy(), BOID_VIEW_RANGE);
|
||||||
// averaging divides by length. Guard against an empty set of neighbors
|
// averaging divides by length. Guard against an empty set of neighbors
|
||||||
// so that we don't divide by zero.
|
// so that we don't divide by zero.
|
||||||
if neighbors.len() > 0 {
|
if !neighbors.is_empty() {
|
||||||
if let Some(avg_velocity) =
|
if let Some(avg_velocity) =
|
||||||
velocity_of_boids(neighbors.iter().map(|(vel, opt_entity)| {
|
velocity_of_boids(neighbors.iter().map(|(vel, opt_entity)| {
|
||||||
// I've observed no panics in the old version, nor the debug_plugins version
|
// I've observed no panics in the old version, nor the debug_plugins version
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ fn update_cursor(
|
|||||||
) {
|
) {
|
||||||
// I'm trusting that only one thing has the `Cursor` component
|
// I'm trusting that only one thing has the `Cursor` component
|
||||||
// It's defined here in this module, so that *should* be the case...
|
// It's defined here in this module, so that *should* be the case...
|
||||||
let win = window.get_single().unwrap();
|
let win = window.single().unwrap();
|
||||||
let (cam, cam_transform) = camera.get_single().unwrap();
|
let (cam, cam_transform) = camera.single().unwrap();
|
||||||
// the cursor might not be on the window. Only adjust position when it is.
|
// the cursor might not be on the window. Only adjust position when it is.
|
||||||
if let Some(cursor_pos_in_window) = win.cursor_position() {
|
if let Some(cursor_pos_in_window) = win.cursor_position() {
|
||||||
// transform the window position into world space
|
// transform the window position into world space
|
||||||
@@ -76,7 +76,7 @@ fn update_cursor(
|
|||||||
let cursor_in_world = cam
|
let cursor_in_world = cam
|
||||||
.viewport_to_world_2d(cam_transform, cursor_pos_in_window)
|
.viewport_to_world_2d(cam_transform, cursor_pos_in_window)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut cursor = cursor_query.get_single_mut().unwrap();
|
let mut cursor = cursor_query.single_mut().unwrap();
|
||||||
cursor.translation = cursor_in_world.extend(0.0);
|
cursor.translation = cursor_in_world.extend(0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ fn update_scanner_mode(
|
|||||||
mut scanner_query: Query<(&mut SelectionMode, &mut ScannerMode), With<Cursor>>,
|
mut scanner_query: Query<(&mut SelectionMode, &mut ScannerMode), With<Cursor>>,
|
||||||
) {
|
) {
|
||||||
// I'm making another assertion that there is exactly one scanner.
|
// I'm making another assertion that there is exactly one scanner.
|
||||||
let (mut select_mode, mut scan_mode) = scanner_query.get_single_mut().unwrap();
|
let (mut select_mode, mut scan_mode) = scanner_query.single_mut().unwrap();
|
||||||
|
|
||||||
// Assign selection mode
|
// Assign selection mode
|
||||||
if keycodes.just_pressed(KeyCode::Digit1) {
|
if keycodes.just_pressed(KeyCode::Digit1) {
|
||||||
@@ -107,7 +107,7 @@ fn update_scanner_mode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn print_gizmo_config(query: Query<(&SelectionMode, &ScannerMode), With<Cursor>>) {
|
fn print_gizmo_config(query: Query<(&SelectionMode, &ScannerMode), With<Cursor>>) {
|
||||||
let (select, scan) = query.get_single().unwrap();
|
let (select, scan) = query.single().unwrap();
|
||||||
println!("Selection: {select:?}, Scanning: {scan:?}");
|
println!("Selection: {select:?}, Scanning: {scan:?}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ fn do_scan(
|
|||||||
/* Push info to summary somewhere */
|
/* Push info to summary somewhere */
|
||||||
mut gizmos: Gizmos,
|
mut gizmos: Gizmos,
|
||||||
) {
|
) {
|
||||||
let (cursor_pos, select_mode, scan_mode) = scanner_query.get_single().unwrap();
|
let (cursor_pos, select_mode, scan_mode) = scanner_query.single().unwrap();
|
||||||
match select_mode {
|
match select_mode {
|
||||||
SelectionMode::NearestSingle => todo!(),
|
SelectionMode::NearestSingle => todo!(),
|
||||||
SelectionMode::CircularArea => {
|
SelectionMode::CircularArea => {
|
||||||
|
|||||||
Reference in New Issue
Block a user