mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
add configureable server info
This commit is contained in:
parent
1213d9844b
commit
bbb024224d
1
.gitignore
vendored
1
.gitignore
vendored
@ -31,5 +31,6 @@
|
|||||||
# Veloren
|
# Veloren
|
||||||
*.rar
|
*.rar
|
||||||
*.log
|
*.log
|
||||||
|
*.ron
|
||||||
run.sh
|
run.sh
|
||||||
screenshots
|
screenshots
|
||||||
|
@ -39,6 +39,6 @@ fn main() {
|
|||||||
// Wait for the next tick.
|
// Wait for the next tick.
|
||||||
clock.tick(Duration::from_millis(1000 / TPS));
|
clock.tick(Duration::from_millis(1000 / TPS));
|
||||||
}
|
}
|
||||||
|
|
||||||
//settings.save_to_file().expect("failed to save the settings!");
|
//settings.save_to_file().expect("failed to save the settings!");
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
@ -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,9 +19,11 @@ 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(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServerSettings {
|
impl ServerSettings {
|
||||||
pub fn load() -> Self {
|
pub fn load() -> Self {
|
||||||
@ -49,4 +52,4 @@ impl ServerSettings {
|
|||||||
fn get_settings_path() -> PathBuf {
|
fn get_settings_path() -> PathBuf {
|
||||||
PathBuf::from(r"settings.ron")
|
PathBuf::from(r"settings.ron")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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()),
|
||||||
|
Loading…
Reference in New Issue
Block a user