omg so much has changed idk

This commit is contained in:
AviiNL
2024-01-18 20:50:27 +01:00
parent f0f0d0c550
commit b0efc215ba
20 changed files with 544 additions and 1104 deletions

View File

@@ -26,7 +26,7 @@ impl Plugin for TripwirePlugin {
fn tripwire(
mut commands: Commands,
awacs: Query<(Entity, &Callsign, &Radio), (With<Awacs>, With<Blue>, With<Radio>)>,
mut players: Query<(&Callsign, &Position, &RadioInfo, &mut Tripwire), With<Player>>,
mut players: Query<(Entity, &Callsign, &Position, &RadioInfo, &mut Tripwire), With<Player>>,
npc: Query<(&Id, &Position, &Heading, &Velocity), (Without<Player>, With<Red>)>,
) {
// get the players radio frequencies
@@ -34,7 +34,7 @@ fn tripwire(
// broadcast message on that ferquency and as that awacs
for (ent, awacs, radio) in awacs.iter() {
for (p_callsign, p_position, radioinfo, mut p_tripwire) in players.iter_mut() {
for (p_ent, p_callsign, p_position, radioinfo, mut p_tripwire) in players.iter_mut() {
// check if user is on the same frequency as awacs
if !radioinfo
.radios
@@ -56,13 +56,14 @@ fn tripwire(
let bra = Braa::new(p_position, n_position, n_heading);
let message = format!("{}, {}, {}", p_callsign, awacs, bra);
let voice_message = format!(
"{}, {}, {}",
"{} . . . {} . . . {}",
p_callsign.to_voice(),
awacs.to_voice(),
bra.to_voice()
);
commands.spawn(TextMessage::new(message));
// commands.spawn((Id::new(player_id.into()), TextMessage::new(message)));
commands.entity(p_ent).insert(TextMessage::new(message));
commands
.entity(ent)
.insert(VoiceMessage::new(voice_message));