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 # Veloren
*.rar *.rar
*.log *.log
*.ron
run.sh run.sh
screenshots screenshots

View File

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

View File

@ -1,5 +1,5 @@
use serde_derive::{Deserialize, Serialize}; 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. /// `ControlSettings` contains keybindings.
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
@ -9,7 +9,8 @@ pub struct ServerSettings {
//pub max_players: u64, //pub max_players: u64,
pub world_seed: u32, pub world_seed: u32,
//pub pvp_enabled: bool, //pub pvp_enabled: bool,
//pub serverinfo: whatever pub server_name: String,
pub server_description: String,
//pub login_server: whatever //pub login_server: whatever
} }
@ -18,6 +19,8 @@ impl Default for ServerSettings {
Self { Self {
address: SocketAddr::from(([0; 4], 59003)), address: SocketAddr::from(([0; 4], 59003)),
world_seed: 1337, 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 // 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 { let server = match client {
Some(client) => server.with_thread_pool(client.thread_pool().clone()), Some(client) => server.with_thread_pool(client.thread_pool().clone()),