add configurable TimeOfDay

This commit is contained in:
Songtronix 2019-07-12 15:03:35 +02:00
parent 1215ced121
commit bfa6a2e2a2
3 changed files with 7 additions and 2 deletions

2
Cargo.lock generated
View File

@ -2765,7 +2765,7 @@ name = "veloren-server"
version = "0.2.0" version = "0.2.0"
dependencies = [ dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"scan_fmt 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "scan_fmt 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -17,7 +17,7 @@ use common::{
comp, comp,
msg::{ClientMsg, ClientState, RequestStateError, ServerError, ServerInfo, ServerMsg}, msg::{ClientMsg, ClientState, RequestStateError, ServerError, ServerInfo, ServerMsg},
net::PostOffice, net::PostOffice,
state::{State, TerrainChange, Uid}, state::{State, TerrainChange, TimeOfDay, Uid},
terrain::{block::Block, TerrainChunk, TerrainChunkSize, TerrainMap}, terrain::{block::Block, TerrainChunk, TerrainChunkSize, TerrainMap},
vol::VolSize, vol::VolSize,
vol::Vox, vol::Vox,
@ -86,6 +86,9 @@ impl Server {
.ecs_mut() .ecs_mut()
.add_resource(SpawnPoint(Vec3::new(16_384.0, 16_384.0, 380.0))); .add_resource(SpawnPoint(Vec3::new(16_384.0, 16_384.0, 380.0)));
// Set starting time for the server.
state.ecs_mut().write_resource::<TimeOfDay>().0 = settings.start_time;
let this = Self { let this = Self {
state, state,
world: Arc::new(World::generate(settings.world_seed)), world: Arc::new(World::generate(settings.world_seed)),

View File

@ -11,6 +11,7 @@ pub struct ServerSettings {
pub server_name: String, pub server_name: String,
pub server_description: String, pub server_description: String,
//pub login_server: whatever //pub login_server: whatever
pub start_time: f64,
} }
impl Default for ServerSettings { impl Default for ServerSettings {
@ -21,6 +22,7 @@ impl Default for ServerSettings {
server_name: "Server name".to_owned(), server_name: "Server name".to_owned(),
server_description: "This is the best Veloren server.".to_owned(), server_description: "This is the best Veloren server.".to_owned(),
max_players: 16, max_players: 16,
start_time: 0.0,
} }
} }
} }