add configureable server info

This commit is contained in:
Songtronix 2019-07-01 11:37:17 +02:00
parent 1213d9844b
commit bbb024224d
5 changed files with 14 additions and 10 deletions

1
.gitignore vendored
View File

@ -31,5 +31,6 @@
# Veloren
*.rar
*.log
*.ron
run.sh
screenshots

View File

@ -100,12 +100,11 @@ impl Server {
chunk_rx,
pending_chunks: HashSet::new(),
server_settings: settings,
server_info: ServerInfo {
// TODO: get from settings
name: "Server name".to_owned(),
description: "This is the best Veloren server.".to_owned(),
name: settings.server_name.clone(),
description: settings.server_description.clone(),
},
server_settings: settings,
};
Ok(this)

View File

@ -1,5 +1,5 @@
use serde_derive::{Deserialize, Serialize};
use std::{fs, io::prelude::*, path::PathBuf, net::SocketAddr};
use std::{fs, io::prelude::*, net::SocketAddr, path::PathBuf};
/// `ControlSettings` contains keybindings.
#[derive(Clone, Debug, Serialize, Deserialize)]
@ -9,7 +9,8 @@ pub struct ServerSettings {
//pub max_players: u64,
pub world_seed: u32,
//pub pvp_enabled: bool,
//pub serverinfo: whatever
pub server_name: String,
pub server_description: String,
//pub login_server: whatever
}
@ -18,6 +19,8 @@ impl Default for ServerSettings {
Self {
address: SocketAddr::from(([0; 4], 59003)),
world_seed: 1337,
server_name: "Server name".to_owned(),
server_description: "This is the best Veloren server.".to_owned(),
}
}
}

View File

@ -36,7 +36,8 @@ impl Singleplayer {
));
// Create server
let server = Server::bind(sock.clone(), ServerSettings::default()).expect("Failed to create server instance!");
let server = Server::bind(sock.clone(), ServerSettings::default())
.expect("Failed to create server instance!");
let server = match client {
Some(client) => server.with_thread_pool(client.thread_pool().clone()),