ignore (almost) stationary targets, they're probably ground-bound
This commit is contained in:
@@ -118,10 +118,7 @@ unsafe impl<T: Command> SystemParam for ConsoleCommand<T> {
|
||||
let clap_command = T::command().no_binary_name(true);
|
||||
let arg_matches = clap_command.try_get_matches_from(command.args.iter());
|
||||
|
||||
debug!(
|
||||
"Trying to parse as `{}`. Result: {arg_matches:?}",
|
||||
command.command_name
|
||||
);
|
||||
debug!("Trying to parse as `{}`.", command.command_name);
|
||||
|
||||
match arg_matches {
|
||||
Ok(matches) => match T::from_arg_matches(&matches) {
|
||||
|
||||
@@ -10,6 +10,7 @@ mod side;
|
||||
mod srs_socket_addr;
|
||||
mod stt_base_url;
|
||||
mod unit_type;
|
||||
mod velocity;
|
||||
|
||||
pub use awacs::*;
|
||||
pub use callsign::*;
|
||||
@@ -23,3 +24,4 @@ pub use side::*;
|
||||
pub use srs_socket_addr::*;
|
||||
pub use stt_base_url::*;
|
||||
pub use unit_type::*;
|
||||
pub use velocity::*;
|
||||
|
||||
14
crates/guardian_core/src/components/velocity.rs
Normal file
14
crates/guardian_core/src/components/velocity.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use bevy::ecs::component::Component;
|
||||
use dcs_grpc::dcs::common::v0::Vector;
|
||||
|
||||
#[derive(Debug, Component)]
|
||||
pub struct Velocity(pub Vector);
|
||||
|
||||
impl Velocity {
|
||||
pub fn speed(&self) -> f64 {
|
||||
let x = self.0.x;
|
||||
let y = self.0.y;
|
||||
let z = self.0.z;
|
||||
(x * x + y * y + z * z).sqrt()
|
||||
}
|
||||
}
|
||||
@@ -173,6 +173,12 @@ fn update_units(
|
||||
e.insert(Heading(orientation.heading));
|
||||
}
|
||||
|
||||
if let Some(velocity) = &event.velocity {
|
||||
if let Some(velocity) = &velocity.velocity {
|
||||
e.insert(Velocity(velocity.clone()));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(playername) = &event.player_name {
|
||||
e.insert(Player::new(playername.clone()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user