mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Addressing MR comments.
This commit is contained in:
parent
3a0483e8ee
commit
02f9c9490b
@ -94,11 +94,7 @@ impl ServerSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn singleplayer() -> Self {
|
pub fn singleplayer() -> Self {
|
||||||
let mut load = Self::load();
|
let load = Self::load();
|
||||||
if let None = load.map_file {
|
|
||||||
// If loading the default map file, make sure the seed is also default.
|
|
||||||
load.world_seed = DEFAULT_WORLD_SEED;
|
|
||||||
};
|
|
||||||
Self {
|
Self {
|
||||||
//BUG: theoretically another process can grab the port between here and server creation, however the timewindow is quite small
|
//BUG: theoretically another process can grab the port between here and server creation, however the timewindow is quite small
|
||||||
gameserver_address: SocketAddr::from((
|
gameserver_address: SocketAddr::from((
|
||||||
@ -109,12 +105,18 @@ impl ServerSettings {
|
|||||||
[127, 0, 0, 1],
|
[127, 0, 0, 1],
|
||||||
pick_unused_port().expect("Failed to find unused port!"),
|
pick_unused_port().expect("Failed to find unused port!"),
|
||||||
)),
|
)),
|
||||||
|
// If loading the default map file, make sure the seed is also default.
|
||||||
|
world_seed: if load.map_file.is_some() {
|
||||||
|
load.world_seed
|
||||||
|
} else {
|
||||||
|
DEFAULT_WORLD_SEED
|
||||||
|
},
|
||||||
server_name: "Singleplayer".to_owned(),
|
server_name: "Singleplayer".to_owned(),
|
||||||
server_description: "Who needs friends anyway?".to_owned(),
|
server_description: "Who needs friends anyway?".to_owned(),
|
||||||
max_players: 100,
|
max_players: 100,
|
||||||
start_time: 9.0 * 3600.0,
|
start_time: 9.0 * 3600.0,
|
||||||
admins: vec!["singleplayer".to_string()], // TODO: Let the player choose if they want to use admin commands or not
|
admins: vec!["singleplayer".to_string()], // TODO: Let the player choose if they want to use admin commands or not
|
||||||
..Self::load() // Fill in remaining fields from settings.ron.
|
..load // Fill in remaining fields from settings.ron.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ roots = "0.0.5"
|
|||||||
serde = "1.0.102"
|
serde = "1.0.102"
|
||||||
serde_derive = "1.0.102"
|
serde_derive = "1.0.102"
|
||||||
ron = "0.5.1"
|
ron = "0.5.1"
|
||||||
pretty_env_logger = "0.3.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
minifb = { git = "https://github.com/emoon/rust_minifb.git" }
|
minifb = { git = "https://github.com/emoon/rust_minifb.git" }
|
||||||
|
pretty_env_logger = "0.3.0"
|
||||||
|
@ -17,8 +17,8 @@ pub use self::map::{MapConfig, MapDebug};
|
|||||||
pub use self::settlement::Settlement;
|
pub use self::settlement::Settlement;
|
||||||
pub use self::util::{
|
pub use self::util::{
|
||||||
cdf_irwin_hall, downhill, get_oceans, local_cells, map_edge_factor, neighbors,
|
cdf_irwin_hall, downhill, get_oceans, local_cells, map_edge_factor, neighbors,
|
||||||
uniform_idx_as_vec2, uniform_noise, uphill, vec2_as_uniform_idx, HybridMulti as HybridMulti_,
|
uniform_idx_as_vec2, uniform_noise, uphill, vec2_as_uniform_idx, InverseCdf, ScaleBias,
|
||||||
InverseCdf, ScaleBias, NEIGHBOR_DELTA,
|
NEIGHBOR_DELTA,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -88,7 +88,7 @@ pub(crate) struct GenCtx {
|
|||||||
pub turb_x_nz: SuperSimplex,
|
pub turb_x_nz: SuperSimplex,
|
||||||
pub turb_y_nz: SuperSimplex,
|
pub turb_y_nz: SuperSimplex,
|
||||||
pub chaos_nz: RidgedMulti,
|
pub chaos_nz: RidgedMulti,
|
||||||
pub alt_nz: HybridMulti_,
|
pub alt_nz: util::HybridMulti,
|
||||||
pub hill_nz: SuperSimplex,
|
pub hill_nz: SuperSimplex,
|
||||||
pub temp_nz: Fbm,
|
pub temp_nz: Fbm,
|
||||||
// Humidity noise
|
// Humidity noise
|
||||||
@ -313,12 +313,12 @@ impl WorldSim {
|
|||||||
.set_frequency(RidgedMulti::DEFAULT_FREQUENCY * (5_000.0 / continent_scale))
|
.set_frequency(RidgedMulti::DEFAULT_FREQUENCY * (5_000.0 / continent_scale))
|
||||||
.set_seed(rng.gen()),
|
.set_seed(rng.gen()),
|
||||||
hill_nz: SuperSimplex::new().set_seed(rng.gen()),
|
hill_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||||
alt_nz: HybridMulti_::new()
|
alt_nz: util::HybridMulti::new()
|
||||||
.set_octaves(8)
|
.set_octaves(8)
|
||||||
.set_frequency((10_000.0 / continent_scale) as f64)
|
.set_frequency((10_000.0 / continent_scale) as f64)
|
||||||
// persistence = lacunarity^(-(1.0 - fractal increment))
|
// persistence = lacunarity^(-(1.0 - fractal increment))
|
||||||
.set_lacunarity(HybridMulti_::DEFAULT_LACUNARITY)
|
.set_lacunarity(util::HybridMulti::DEFAULT_LACUNARITY)
|
||||||
.set_persistence(HybridMulti_::DEFAULT_LACUNARITY.powf(-(1.0 - 0.0)))
|
.set_persistence(util::HybridMulti::DEFAULT_LACUNARITY.powf(-(1.0 - 0.0)))
|
||||||
.set_offset(0.0)
|
.set_offset(0.0)
|
||||||
.set_seed(rng.gen()),
|
.set_seed(rng.gen()),
|
||||||
temp_nz: Fbm::new()
|
temp_nz: Fbm::new()
|
||||||
|
Loading…
Reference in New Issue
Block a user