map: fix hiding of orbit lines

This commit is contained in:
yuni 2024-11-25 22:55:03 +01:00
parent 1e9f6aa057
commit 16d7a9ae2d

View file

@ -671,7 +671,7 @@ pub fn apply_input_to_player(
pub fn update_map_only_object_visibility(
settings: Res<var::Settings>,
q_camera: Query<&Transform, With<Camera>>,
q_player: Query<&Position, With<actor::PlayerCamera>>,
q_player: Query<(&Transform, &Position), (With<actor::PlayerCamera>, Without<Camera>)>,
mut q_onlyinmap: Query<(&mut Visibility, &ShowOnlyInMap), Without<Camera>>,
id2pos: Res<game::Id2Pos>,
) {
@ -679,8 +679,8 @@ pub fn update_map_only_object_visibility(
return;
}
let cam: &Transform = q_camera.get_single().unwrap();
let player_pos: &Position = q_player.get_single().unwrap();
let cam_pos: Vec3 = cam.translation + player_pos.as_vec3();
let (player_trans, player_pos) = q_player.get_single().unwrap();
let cam_pos: Vec3 = cam.translation - player_trans.translation + player_pos.0.as_vec3();
for (mut vis, onlyinmap) in &mut q_onlyinmap {
if settings.map_active && settings.hud_active {
if onlyinmap.distance_to_id.is_empty() {