mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Make minimum multiplayer level configurable, (default 0); close #141
This commit is contained in:
@@ -637,6 +637,8 @@ fn default_multiplayer() -> super::MultiplayerConfig {
|
||||
pit_config: super::multiplayer::default_pit_conf(),
|
||||
team_death_match: super::multiplayer::default_tdm_conf(),
|
||||
vehicle_validator: super::multiplayer::default_validator(),
|
||||
minimum_level: 0,
|
||||
minimum_cpu: super::multiplayer::default_minimum_cpu(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -453,6 +453,8 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
|
||||
is_enabled: self.battle.multiplayer.enabled,
|
||||
lobby_autostart_after: self.battle.multiplayer.autostart_after_s.map(std::time::Duration::from_secs),
|
||||
loading_autostart_after: self.battle.multiplayer.continue_loading_after_s.map(std::time::Duration::from_secs),
|
||||
min_level: self.battle.multiplayer.minimum_level as i32,
|
||||
min_cpu: self.battle.multiplayer.minimum_cpu as i32,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -553,6 +553,8 @@ pub struct MultiplayerSettings {
|
||||
pub is_enabled: bool,
|
||||
pub lobby_autostart_after: Option<std::time::Duration>,
|
||||
pub loading_autostart_after: Option<std::time::Duration>,
|
||||
pub min_level: i32,
|
||||
pub min_cpu: i32,
|
||||
}
|
||||
|
||||
pub struct VehicleValidators {
|
||||
|
||||
@@ -22,6 +22,10 @@ pub struct MultiplayerConfig {
|
||||
pub team_death_match: TeamDeathMatchConfig,
|
||||
#[serde(default = "default_validator")]
|
||||
pub vehicle_validator: super::VehicleValidator,
|
||||
#[serde(default)]
|
||||
pub minimum_level: u16,
|
||||
#[serde(default = "default_minimum_cpu")]
|
||||
pub minimum_cpu: u16,
|
||||
}
|
||||
|
||||
impl super::config::SelfValidator for MultiplayerConfig {
|
||||
@@ -130,6 +134,10 @@ pub(super) fn default_continue_loading_after_s() -> Option<u64> {
|
||||
Some(30)
|
||||
}
|
||||
|
||||
pub(super) fn default_minimum_cpu() -> u16 {
|
||||
100
|
||||
}
|
||||
|
||||
pub(super) fn default_net_conf() -> NetworkConf {
|
||||
NetworkConf {
|
||||
network_channel_ty: "3113".to_owned(),
|
||||
|
||||
Reference in New Issue
Block a user