refactor: joined on &stats twice

This commit is contained in:
timokoesters 2019-10-05 15:58:58 +02:00 committed by Piotr Korgól
parent 2fc4a8d9aa
commit 4a99e5bc1e

View File

@ -489,18 +489,12 @@ impl Hud {
let mut health_back_id_walker = self.ids.health_bar_backs.walk();
// Render Name Tags
for (pos, name, level, scale) in (
&entities,
&pos,
&stats,
&stats,
players.maybe(),
scales.maybe(),
)
for (pos, name, level, scale) in
(&entities, &pos, &stats, players.maybe(), scales.maybe())
.join()
.filter(|(entity, _, stats, _, _, _)| *entity != me && !stats.is_dead)
.filter(|(entity, _, stats, _, _)| *entity != me && !stats.is_dead)
// Don't process nametags outside the vd (visibility further limited by ui backend)
.filter(|(_, pos, _, _, _, _)| {
.filter(|(_, pos, _, _, _)| {
Vec2::from(pos.0 - player_pos)
.map2(TerrainChunk::RECT_SIZE, |d: f32, sz| {
d.abs() as f32 / sz as f32
@ -508,7 +502,7 @@ impl Hud {
.magnitude()
< view_distance as f32
})
.map(|(_, pos, stats, _, player, scale)| {
.map(|(_, pos, stats, player, scale)| {
// TODO: This is temporary
// If the player used the default character name display their name instead
let name = if stats.name == "Character Name" {