1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Handle game event change situation in lobby queue

This commit is contained in:
NG (Graham)
2025-07-24 22:17:31 -04:00
parent f48334ef0c
commit 9f90c2e5fb
8 changed files with 96 additions and 7 deletions

View File

@@ -389,7 +389,7 @@ fn default_rotation() -> GameEventSequence {
auto_heal: true,
},
multiplayer: GameEvent {
map: GameMap::Mars1,
map: GameMap::Earth1,
visibility: GameVisibility::Poor,
mode: GameType::SuddenDeath,
auto_heal: true,
@@ -449,7 +449,7 @@ fn default_rotation() -> GameEventSequence {
auto_heal: true,
},
multiplayer: GameEvent {
map: GameMap::Mars1,
map: GameMap::Earth2,
visibility: GameVisibility::Poor,
mode: GameType::SuddenDeath,
auto_heal: true,

View File

@@ -262,6 +262,7 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
super::ServerConfig {
database: self.settings.server.database.clone(),
auto_signup: self.settings.server.auto_signup,
queue_mode: super::QueueChangeMode::from_persist(self.settings.server.queue_mode.clone()),
}
}

View File

@@ -2,7 +2,7 @@ mod cubes_json;
pub use cubes_json::CubeConfig;
mod traits;
pub use traits::{ConfigProvider, CompleteCampaignProvider, DevMessageProvider, ServerConfig, GarageUpgrades, GarageUpgradeIncrement, ChatSystemConfig, GameEventSequence, GameEvents, GameRotationStrategy, GameEvent, GameMap, GameVisibility, GameType, SingleplayerConfig, VehicleInfo, VehicleDescriptor};
pub use traits::{ConfigProvider, CompleteCampaignProvider, DevMessageProvider, ServerConfig, GarageUpgrades, GarageUpgradeIncrement, ChatSystemConfig, GameEventSequence, GameEvents, GameRotationStrategy, GameEvent, GameMap, GameVisibility, GameType, SingleplayerConfig, VehicleInfo, VehicleDescriptor, QueueChangeMode};
pub type ConfigImpl = CubeConfig;

View File

@@ -104,6 +104,23 @@ pub struct TypedDevMessage<C> {
pub struct ServerConfig {
pub database: String,
pub auto_signup: bool,
pub queue_mode: QueueChangeMode,
}
pub enum QueueChangeMode {
Upgrade, // move enqueued players into newer gamemode
Notify, // send match change
Ignore, // do nothing
}
impl QueueChangeMode {
pub(super) fn from_persist(persist: crate::persist::settings::QueueMode) -> Self {
match persist {
crate::persist::settings::QueueMode::Upgrade => Self::Upgrade,
crate::persist::settings::QueueMode::Notify => Self::Notify,
crate::persist::settings::QueueMode::Ignore => Self::Ignore,
}
}
}
#[derive(Clone, Debug)]

View File

@@ -27,7 +27,7 @@ mod client_config;
pub use client_config::GameplaySettings;
mod settings;
pub use settings::Settings;
pub use settings::{Settings, QueueMode};
mod chat;
pub use chat::{ChatConfig, ChatCommand, ChatOperation, BuiltInChatOperation};

View File

@@ -74,6 +74,16 @@ pub struct ServerSettings {
pub database: String,
#[serde(default)]
pub auto_signup: bool,
#[serde(default)]
pub queue_mode: QueueMode,
}
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
pub enum QueueMode {
Upgrade, // move enqueued players into newer gamemode
#[default]
Notify, // send match change
Ignore, // do nothing
}
fn default_db_conn() -> String {
@@ -84,5 +94,6 @@ fn default_server_conf() -> ServerSettings {
ServerSettings {
database: default_db_conn(),
auto_signup: false,
queue_mode: QueueMode::Notify,
}
}