Merge branch 'master' of gitlab.com:veloren/veloren into sharp/jungle

This commit is contained in:
Joshua Yanovski 2019-08-22 23:48:22 +02:00
commit 688563accf
2 changed files with 43 additions and 5 deletions

View File

@ -1,10 +1,13 @@
use std::env;
use std::fs::File;
use std::io::Read;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use std::process::Command;
fn main() {
// Get the current githash
match Command::new("git")
.args(&["rev-parse", "--short", "HEAD"])
.output()
@ -26,4 +29,33 @@ fn main() {
},
Err(e) => panic!("failed to retrieve current git commit hash: {}", e),
}
// Check if git-lfs is working
let asset_path: PathBuf = ["..", "assets", "voxygen", "background", "bg_main.png"]
.iter()
.collect();
let asset_file = match File::open(&asset_path) {
Ok(file) => file,
Err(e) => panic!(
"failed to open asset file {}: {}",
asset_path.to_str().unwrap(),
e
),
};
const LFS_MARKER: &[u8] = b"version https://git-lfs.github.com/spec/";
let mut buffer = Vec::new();
let bytes_read = asset_file
.take(LFS_MARKER.len() as u64)
.read_to_end(&mut buffer)
.expect("failed to read asset file");
if bytes_read == LFS_MARKER.len() && buffer == LFS_MARKER {
panic!(
"\n\nGit Large File Storage (git-lfs) has not been set up correctly.\n\
Most common reasons:\n\
\t- git-lfs was not installed before cloning this repository\n\
\t- this repository was not cloned from the primary gitlab mirror.\n\
\t The github mirror does not support lfs.\n\
See the book at https://book.veloren.net/ for details.\n\n"
);
}
}

View File

@ -574,14 +574,14 @@ impl Hud {
.color(TEXT_COLOR)
.set(self.ids.version, ui_widgets);
// Ticks per second
Text::new(&format!("FPS: {:.1}", debug_info.tps))
Text::new(&format!("FPS: {:.0}", debug_info.tps))
.color(TEXT_COLOR)
.down_from(self.ids.version, 5.0)
.font_id(self.fonts.opensans)
.font_size(14)
.set(self.ids.fps_counter, ui_widgets);
// Ping
Text::new(&format!("Ping: {:.1}ms", debug_info.ping_ms))
Text::new(&format!("Ping: {:.0}ms", debug_info.ping_ms))
.color(TEXT_COLOR)
.down_from(self.ids.fps_counter, 5.0)
.font_id(self.fonts.opensans)
@ -589,7 +589,10 @@ impl Hud {
.set(self.ids.ping, ui_widgets);
// Player's position
let coordinates_text = match debug_info.coordinates {
Some(coordinates) => format!("Coordinates: {:.1}", coordinates.0),
Some(coordinates) => format!(
"Coordinates: ({:.0}, {:.0}, {:.0})",
coordinates.0.x, coordinates.0.y, coordinates.0.z,
),
None => "Player has no Pos component".to_owned(),
};
Text::new(&coordinates_text)
@ -601,8 +604,11 @@ impl Hud {
// Player's velocity
let velocity_text = match debug_info.velocity {
Some(velocity) => format!(
"Velocity: ({:.3}, {:.3}, {:.3})",
velocity.0.x, velocity.0.y, velocity.0.z
"Velocity: ({:.1}, {:.1}, {:.1}) [{:.1} u/s]",
velocity.0.x,
velocity.0.y,
velocity.0.z,
velocity.0.magnitude()
),
None => "Player has no Vel component".to_owned(),
};