voice no longer hard-coded, bogeydope ordering fix, tripwire ignoring on-ground units
This commit is contained in:
10
Cargo.lock
generated
10
Cargo.lock
generated
@@ -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"
|
||||
|
||||
@@ -30,7 +30,7 @@ opt-level = 3
|
||||
|
||||
[workspace.dependencies]
|
||||
bevy = { version = "0.12", features = [
|
||||
"dynamic_linking",
|
||||
# "dynamic_linking",
|
||||
"multi-threaded",
|
||||
"trace",
|
||||
] }
|
||||
|
||||
@@ -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<String>) -> 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ impl Config {
|
||||
ChannelConfig {
|
||||
frequency: 251000000,
|
||||
modulation: Modulation::Am,
|
||||
voice: Voice::David,
|
||||
voice: Voice::new("David"),
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ fn give_awacs_radio(
|
||||
commands.entity(ent).insert(Radio::new(
|
||||
channel.frequency,
|
||||
channel.modulation,
|
||||
channel.voice,
|
||||
channel.voice.clone(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user