diff --git a/Cargo.lock b/Cargo.lock index 2fd4fbe..d3f4b07 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -501,7 +501,6 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4bc7e09282a82a48d70ade0c4c1154b0fd7882a735a39c66766a5d0f4718ea9" dependencies = [ - "bevy_dylib", "bevy_internal", ] @@ -677,15 +676,6 @@ dependencies = [ "sysinfo", ] -[[package]] -name = "bevy_dylib" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45b99001eb4837c78d9c63cc8b32fda61ea96b194a2cda54b569aeee69a9853c" -dependencies = [ - "bevy_internal", -] - [[package]] name = "bevy_ecs" version = "0.12.1" diff --git a/Cargo.toml b/Cargo.toml index b1e2f41..2776397 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ opt-level = 3 [workspace.dependencies] bevy = { version = "0.12", features = [ - "dynamic_linking", + # "dynamic_linking", "multi-threaded", "trace", ] } diff --git a/crates/guardian_core/src/srs.rs b/crates/guardian_core/src/srs.rs index 75568b8..e7671e5 100644 --- a/crates/guardian_core/src/srs.rs +++ b/crates/guardian_core/src/srs.rs @@ -162,7 +162,7 @@ fn listen_srs( let frequency = radio.frequency; let id = *id; - let voice = radio.voice; + let voice = radio.voice.clone(); let stt_url = stt_url.as_str().to_string(); radio.handle = Some(tokio.0.spawn(async move { loop { @@ -520,19 +520,18 @@ fn handle_voice_command( } } -#[derive(Default, Clone, Copy, Debug, Deserialize, Serialize)] -pub enum Voice { - #[default] - David, - Zira, +#[derive(Default, Clone, Debug, Deserialize, Serialize)] +pub struct Voice(String); + +impl Voice { + pub fn new(voice: impl Into) -> Self { + Self(voice.into()) + } } impl std::fmt::Display for Voice { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::David => write!(f, "David"), - Self::Zira => write!(f, "Zira"), - } + write!(f, "{}", self.0) } } diff --git a/src/commands/bogeydope.rs b/src/commands/bogeydope.rs index 26bb4fb..7f3e194 100644 --- a/src/commands/bogeydope.rs +++ b/src/commands/bogeydope.rs @@ -47,11 +47,11 @@ pub fn bogey_dope( return; }; - let mut distance: f64 = 0.0; + let mut distance: f64 = f64::MAX; let mut n = (None, None); for (n_pos, n_heading) in npc.iter() { let d = p_pos.distance_to_nmi(n_pos); - if distance < d { + if d < distance { distance = d; n = (Some(n_pos), Some(n_heading)); } diff --git a/src/config.rs b/src/config.rs index 0ad67f0..816eb06 100644 --- a/src/config.rs +++ b/src/config.rs @@ -57,7 +57,7 @@ impl Config { ChannelConfig { frequency: 251000000, modulation: Modulation::Am, - voice: Voice::David, + voice: Voice::new("David"), }, ); diff --git a/src/main.rs b/src/main.rs index 43cf6dd..093a3a3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,7 +67,7 @@ fn give_awacs_radio( commands.entity(ent).insert(Radio::new( channel.frequency, channel.modulation, - channel.voice, + channel.voice.clone(), )); } } diff --git a/src/tripwire.rs b/src/tripwire.rs index b6d050c..04233da 100644 --- a/src/tripwire.rs +++ b/src/tripwire.rs @@ -45,6 +45,10 @@ fn tripwire( } for (n_id, n_position, n_heading) in npc.iter() { + if n_position.angels() == 0 { + // ignore on-ground units + continue; + } let distance = n_position.distance_to_nmi(p_position); if distance <= p_tripwire.range && !p_tripwire.reported.contains(n_id) { p_tripwire.reported.push(*n_id);