This commit is contained in:
AviiNL
2023-12-23 09:54:55 +01:00
parent 945cf75242
commit 5beec8d9b9
13 changed files with 69 additions and 47 deletions

View File

@@ -5,6 +5,7 @@ use bevy::ecs::{
use clap::Parser;
use guardian_commands::{ConsoleCommand, NamedCommand};
use guardian_core::{components::*, dcs::text::TextMessage, srs::voice::VoiceMessage};
use tracing::debug;
use crate::braa::Braa;
@@ -37,12 +38,12 @@ pub fn bogey_dope(
};
let Ok((p_callsign, p_pos)) = player.get(*pilot) else {
eprintln!("no player, died?");
debug!("no player, died?");
return;
};
let Ok(a_callsign) = awacs.get(*operator) else {
eprintln!("no awacs, they died?");
debug!("no awacs, they died?");
return;
};

View File

@@ -2,6 +2,7 @@ use bevy::ecs::system::{Commands, Query, Resource};
use clap::Parser;
use guardian_commands::{ConsoleCommand, NamedCommand};
use guardian_core::{components::*, dcs::text::TextMessage, srs::voice::VoiceMessage};
use tracing::debug;
use crate::tripwire::Tripwire;
@@ -25,20 +26,21 @@ pub fn clear_tripwire(
return;
};
let Some(pilot) = &cmd.pilot else {
return; // no pilot
debug!("no pilot");
return;
};
let Some(operator) = &cmd.operator else {
eprintln!("no operator");
debug!("no operator");
return;
};
let Ok(p_callsign) = callsign.get(*pilot) else {
eprintln!("no player, died?");
debug!("no player, died?");
return;
};
let Ok(a_callsign) = callsign.get(*operator) else {
eprintln!("no awacs, they died?");
debug!("no awacs, they died?");
return;
};

View File

@@ -2,6 +2,7 @@ use bevy::ecs::system::{Commands, Query, Resource};
use clap::Parser;
use guardian_commands::{ConsoleCommand, NamedCommand};
use guardian_core::{components::*, dcs::text::TextMessage, srs::voice::VoiceMessage};
use tracing::debug;
#[derive(Parser, Debug)]
pub struct RadioCheck;
@@ -23,19 +24,21 @@ pub fn radio_check(
return;
};
let Some(pilot) = &cmd.pilot else {
return; // no pilot
debug!("no pilot");
return;
};
let Some(operator) = &cmd.operator else {
debug!("no operator");
return;
};
let Ok(p_callsign) = callsign.get(*pilot) else {
eprintln!("no player, died?");
debug!("no player, died?");
return;
};
let Ok(a_callsign) = callsign.get(*operator) else {
eprintln!("no awacs, they died?");
debug!("no awacs, they died?");
return;
};

View File

@@ -2,6 +2,7 @@ use bevy::ecs::system::{Commands, Query, Resource};
use clap::Parser;
use guardian_commands::{ConsoleCommand, NamedCommand};
use guardian_core::{components::*, dcs::text::TextMessage, srs::voice::VoiceMessage};
use tracing::debug;
use crate::tripwire::Tripwire;
@@ -25,25 +26,25 @@ pub fn set_tripwire(
return;
};
let Some(pilot) = &cmd.pilot else {
return; // no pilot
};
let Some(operator) = &cmd.operator else {
eprintln!("no operator");
debug!("no pilot");
return;
};
let Some(readback) = &cmd.raw else {
eprintln!("no readback");
// no raw found, wut
let Some(operator) = &cmd.operator else {
debug!("no operator");
return;
};
let Ok(p_callsign) = callsign.get(*pilot) else {
eprintln!("no player, died?");
debug!("no player, died?");
return;
};
let Ok(a_callsign) = callsign.get(*operator) else {
eprintln!("no awacs, they died?");
debug!("no awacs, they died?");
return;
};
let Some(readback) = &cmd.raw else {
debug!("no readback");
return;
};
@@ -51,10 +52,8 @@ pub fn set_tripwire(
// check the last part, if it's a number, interpret as miles
let Some(last) = parts.nth_back(0) else {
eprintln!("no last part?");
// there is no last.. dafuq?
// there is always a last, otherwise we wouldnt be here
return; // readback error
debug!("no last part");
return;
};
let distance = match last.parse::<i32>() {

View File

@@ -23,6 +23,18 @@ use tripwire::TripwirePlugin;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let subscriber = tracing_subscriber::FmtSubscriber::builder()
.with_env_filter(
"trace,bevy=error,tokio_util=error,h2=error,hyper=error,tower=error,tonic=error",
)
// .with_span_events(tracing_subscriber::fmt::format::FmtSpan::CLOSE)
.with_file(false)
.with_line_number(false)
.with_target(true)
.finish();
tracing::subscriber::set_global_default(subscriber)?;
let config = Config::load("config.toml".into())?;
App::new()
@@ -50,6 +62,8 @@ fn give_awacs_radio(
continue; // not configured for this unit
};
bevy::log::info!("{} now has a radio", callsign);
commands.entity(ent).insert(Radio::new(
channel.frequency,
channel.modulation,