This commit is contained in:
yuni 2024-05-08 01:00:58 +02:00
parent a8d824ad16
commit 0a4e3c3006

View file

@ -166,8 +166,8 @@ pub fn update_map_camera(
settings: Res<var::Settings>,
mut mapcam: ResMut<MapCam>,
mut q_camera: Query<&mut Transform, (With<Camera>, Without<actor::PlayerCamera>)>,
q_playercam: Query<(Entity, &Transform, &Position), (With<actor::PlayerCamera>, Without<Camera>)>,
q_target: Query<(Entity, &Transform, &Position), (With<hud::IsTargeted>, Without<Camera>, Without<actor::PlayerCamera>)>,
q_playercam: Query<(Entity, &Transform), (With<actor::PlayerCamera>, Without<Camera>)>,
q_target: Query<(Entity, &Transform), (With<hud::IsTargeted>, Without<Camera>, Without<actor::PlayerCamera>)>,
q_target_changed: Query<(), Changed<hud::IsTargeted>>,
mut mouse_events: EventReader<MouseMotion>,
mut er_mousewheel: EventReader<MouseWheel>,
@ -177,11 +177,11 @@ pub fn update_map_camera(
return;
}
let mut camera_transform = q_camera.get_single_mut().unwrap();
let (player_entity, player_trans, player_pos) = q_playercam.get_single().unwrap();
let (target_entity, target_trans, target_pos) = if let Ok(target) = q_target.get_single() {
let (player_entity, player_trans) = q_playercam.get_single().unwrap();
let (target_entity, target_trans) = if let Ok(target) = q_target.get_single() {
target
} else {
(player_entity, player_trans, player_pos)
(player_entity, player_trans)
};
mapcam.center_on_entity = Some(target_entity);