Drone has "no jumping" implemented

main
Elijah C. Voigt 2 years ago
parent 7e69ae134a
commit 0edfcfec5b

@ -31,7 +31,6 @@ impl Plugin for DebugPlugin {
toggle_debug_mode.run_if(on_event::<KeyboardInput>()), toggle_debug_mode.run_if(on_event::<KeyboardInput>()),
display_diagnostics.run_if(resource_exists::<DebugEnabled>), display_diagnostics.run_if(resource_exists::<DebugEnabled>),
toggle_debug_ui.run_if(resource_changed_or_removed::<DebugEnabled>()), toggle_debug_ui.run_if(resource_changed_or_removed::<DebugEnabled>()),
camera_info.run_if(resource_exists::<DebugEnabled>),
), ),
); );
} }
@ -128,7 +127,13 @@ fn display_diagnostics(
root.iter_mut().for_each(|mut text| { root.iter_mut().for_each(|mut text| {
text.sections = diagnostics text.sections = diagnostics
.iter() .iter()
.map(|d| format!("{}: {:.0}\n", d.suffix, d.smoothed().unwrap_or(0.0),)) .map(|d| {
format!(
"{}: {:.0}\n",
d.path().as_str(),
d.smoothed().unwrap_or(0.0),
)
})
.chain(debug_infos.iter().map(|(k, v)| format!("{}: {}\n", k, v))) .chain(debug_infos.iter().map(|(k, v)| format!("{}: {}\n", k, v)))
.map(|s| TextSection::new(s, TextStyle { ..default() })) .map(|s| TextSection::new(s, TextStyle { ..default() }))
.collect(); .collect();
@ -136,19 +141,6 @@ fn display_diagnostics(
}); });
} }
fn camera_info(mut debug_infos: ResMut<DebugInfo>, cameras: Query<(&Camera, &Name)>) {
let camera_names = cameras
.iter()
.filter(|(c, _)| c.is_active)
.map(|(_, n)| n.as_str())
.collect::<Vec<&str>>()
.iter()
.copied()
.intersperse(", ")
.collect::<String>();
debug_infos.set("Cameras".into(), camera_names);
}
fn aabb_gizmo( fn aabb_gizmo(
added: Query<Entity, Added<game::Selected>>, added: Query<Entity, Added<game::Selected>>,
mut removed: RemovedComponents<game::Selected>, mut removed: RemovedComponents<game::Selected>,

@ -1232,7 +1232,7 @@ fn setup_dissolve_materials(
base.alpha_mode = AlphaMode::Mask(0.5); base.alpha_mode = AlphaMode::Mask(0.5);
base.base_color = base.base_color.clone().with_a(0.0); base.base_color = base.base_color.clone().with_a(0.0);
info!("Base material {:#?}", base); debug!("Base material {:#?}", base);
let dis_handle = dissolve_materials.add(ExtendedMaterial { base, extension }); let dis_handle = dissolve_materials.add(ExtendedMaterial { base, extension });

@ -366,7 +366,7 @@ impl Board {
}); });
} }
// Capture the intened move in the moves ledger // Capture the intended move in the moves ledger
moves.push(Move { moves.push(Move {
epoch, epoch,
from, from,
@ -419,8 +419,8 @@ impl Board {
let valid_capture = { let valid_capture = {
match self.at(this_board_index) { match self.at(this_board_index) {
Some(_) => { Some(_) => {
let same_side = Board::side(current_board_index); Board::side(this_board_index)
Board::side(this_board_index) != same_side != Board::side(current_board_index)
} }
None => true, None => true,
} }
@ -478,9 +478,31 @@ impl Board {
.collect(), .collect(),
// One or two spaces in either horizontal // One or two spaces in either horizontal
Some(Piece::Drone) => std::iter::empty() Some(Piece::Drone) => std::iter::empty()
.chain((-2..=2).map(|i| (x.checked_add_signed(i), Some(y)))) // Checking moves on the X axis
.chain((-2..=2).map(|i| (Some(x), y.checked_add_signed(i)))) .chain(
.filter_map(f) (-2..=-1)
.map(|i| f((x.checked_add_signed(i), Some(y))))
.rev()
.take_while(|x| x.is_some()),
)
.chain(
(1..=2)
.map(|i| f((x.checked_add_signed(i), Some(y))))
.take_while(|x| x.is_some()),
)
// Checking moves on the Y axis
.chain(
(1..=2)
.map(|i| f((Some(x), y.checked_add_signed(i))))
.take_while(|x| x.is_some()),
)
.chain(
(-2..=-1)
.map(|i| f((Some(x), y.checked_add_signed(i))))
.rev()
.take_while(|x| x.is_some()),
)
.filter_map(|x| x)
.collect(), .collect(),
// Any distance in any straight line // Any distance in any straight line
Some(Piece::Queen) => std::iter::empty() Some(Piece::Queen) => std::iter::empty()

Loading…
Cancel
Save