prevent entering vehicles with interact key when starting a conversation

This commit is contained in:
yuni 2024-11-17 21:39:31 +01:00
parent baa68240c5
commit 26729c6f61

View file

@ -475,6 +475,8 @@ pub fn handle_input(
let player_entity = player.get_single().unwrap(); let player_entity = player.get_single().unwrap();
if keyboard_input.just_pressed(settings.key_interact) { if keyboard_input.just_pressed(settings.key_interact) {
let mut done = false;
// Talking to people // Talking to people
let objects: Vec<(chat::Talker, &Transform)> = q_talker let objects: Vec<(chat::Talker, &Transform)> = q_talker
.iter() .iter()
@ -487,10 +489,12 @@ pub fn handle_input(
ew_conv.send(chat::StartConversationEvent { ew_conv.send(chat::StartConversationEvent {
talker: talker.clone(), talker: talker.clone(),
}); });
done = true;
} }
} }
// Entering Vehicles // Entering Vehicles
if q_player_drives.is_empty() { if !done && q_player_drives.is_empty() {
// Sort vehicles by their distance to the player // Sort vehicles by their distance to the player
let objects: Vec<((Entity, &Actor, Option<&MessageOnVehicleEntry>), &Transform)> = let objects: Vec<((Entity, &Actor, Option<&MessageOnVehicleEntry>), &Transform)> =
q_vehicles q_vehicles