Lightyear setup (#55)
This commit is contained in:
@@ -114,11 +114,11 @@ fn update_player_aim(
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(e) = &aim_target.0 {
|
||||
if commands.get_entity(*e).is_err() {
|
||||
aim_target.0 = None;
|
||||
return;
|
||||
}
|
||||
if let Some(e) = &aim_target.0
|
||||
&& commands.get_entity(*e).is_err()
|
||||
{
|
||||
aim_target.0 = None;
|
||||
return;
|
||||
}
|
||||
|
||||
if new_target != aim_target.0 {
|
||||
@@ -166,11 +166,11 @@ fn update_npc_aim(
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(e) = &aim_target.0 {
|
||||
if commands.get_entity(*e).is_err() {
|
||||
aim_target.0 = None;
|
||||
return;
|
||||
}
|
||||
if let Some(e) = &aim_target.0
|
||||
&& commands.get_entity(*e).is_err()
|
||||
{
|
||||
aim_target.0 = None;
|
||||
return;
|
||||
}
|
||||
|
||||
if new_target != aim_target.0 {
|
||||
|
||||
@@ -140,16 +140,16 @@ fn sync(
|
||||
target_data: Query<(&Hitpoints, &ActiveHeads), With<Npc>>,
|
||||
) {
|
||||
let mut new_state = None;
|
||||
if let Some(e) = player_target.iter().next().and_then(|target| target.0) {
|
||||
if let Ok((hp, heads)) = target_data.get(e) {
|
||||
let head = heads.current().expect("target must have a head on");
|
||||
new_state = Some(UiHeadState {
|
||||
head: head.head,
|
||||
health: hp.health(),
|
||||
ammo: 1.,
|
||||
reloading: None,
|
||||
});
|
||||
}
|
||||
if let Some(e) = player_target.iter().next().and_then(|target| target.0)
|
||||
&& let Ok((hp, heads)) = target_data.get(e)
|
||||
{
|
||||
let head = heads.current().expect("target must have a head on");
|
||||
new_state = Some(UiHeadState {
|
||||
head: head.head,
|
||||
health: hp.health(),
|
||||
ammo: 1.,
|
||||
reloading: None,
|
||||
});
|
||||
}
|
||||
|
||||
if new_state != target.head {
|
||||
|
||||
Reference in New Issue
Block a user