From e65d0eeb80cc9cd949493d00e47606e96471a768 Mon Sep 17 00:00:00 2001 From: "NG (Graham)" Date: Mon, 22 Jun 2026 19:22:28 -0400 Subject: [PATCH] Add config flag to disallow parties joining the lobby --- rc_core/src/persist/config/cubes_json.rs | 1 + rc_core/src/persist/config/traits.rs | 1 + rc_core/src/persist/settings.rs | 3 +++ rc_lobby_room/src/lobby.rs | 14 +++++++++++++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/rc_core/src/persist/config/cubes_json.rs b/rc_core/src/persist/config/cubes_json.rs index 4418ca0..e81d1a7 100644 --- a/rc_core/src/persist/config/cubes_json.rs +++ b/rc_core/src/persist/config/cubes_json.rs @@ -319,6 +319,7 @@ impl super::ConfigProvider for CubeConfig { auto_signup: self.settings.server.auto_signup, allow_signup: self.settings.server.allow_signup, queue_mode: super::QueueChangeMode::from_persist(self.settings.server.queue_mode.clone()), + allow_parties: self.settings.server.allow_parties, domain: self.settings.server.domain.to_owned(), cdn_url: self.settings.server.cdn_url.trim_end_matches('/').to_owned(), auth_url: self.settings.server.auth_url.trim_end_matches('/').to_owned(), diff --git a/rc_core/src/persist/config/traits.rs b/rc_core/src/persist/config/traits.rs index 391ea76..cb83e0e 100644 --- a/rc_core/src/persist/config/traits.rs +++ b/rc_core/src/persist/config/traits.rs @@ -97,6 +97,7 @@ pub struct ServerConfig { pub auto_signup: bool, pub allow_signup: bool, pub queue_mode: QueueChangeMode, + pub allow_parties: bool, pub domain: String, pub cdn_url: String, pub auth_url: String, diff --git a/rc_core/src/persist/settings.rs b/rc_core/src/persist/settings.rs index 2a8ad27..86fb85a 100644 --- a/rc_core/src/persist/settings.rs +++ b/rc_core/src/persist/settings.rs @@ -99,6 +99,8 @@ pub struct ServerSettings { pub allow_signup: bool, #[serde(default)] pub queue_mode: QueueMode, + #[serde(default = "default_true")] + pub allow_parties: bool, #[serde(default = "default_domain_root")] pub domain: String, #[serde(default = "default_cdn_root_url")] @@ -151,6 +153,7 @@ fn default_server_conf() -> ServerSettings { auto_signup: false, allow_signup: true, queue_mode: QueueMode::Notify, + allow_parties: true, domain: default_domain_root(), cdn_url: default_cdn_root_url(), auth_url: default_auth_root_url(), diff --git a/rc_lobby_room/src/lobby.rs b/rc_lobby_room/src/lobby.rs index 0504909..c260b78 100644 --- a/rc_lobby_room/src/lobby.rs +++ b/rc_lobby_room/src/lobby.rs @@ -117,6 +117,7 @@ pub struct QueueHandler { custom_game_for_user: std::sync::Arc>>, users_per_game: usize, is_enabled: bool, + is_parties_enabled: bool, hostname: String, hostport: u16, network_conf: crate::data::network::NetworkConfigData, @@ -140,19 +141,21 @@ impl QueueHandler { ) -> Self { let (domain, port_str) = game_host.split_once(':').expect("Invalid redirect address (must be domain:port)"); let mp_settings = oj_rc_core::ConfigProvider::<()>::multiplayer_settings(conf); + let server_conf = >::server_config(conf); Self { users_in_queue: std::sync::Arc::new(tokio::sync::Mutex::new(HashMap::new())), users_in_custom_games_queue: std::sync::Arc::new(tokio::sync::Mutex::new(HashMap::new())), custom_game_for_user: std::sync::Arc::new(tokio::sync::RwLock::new(HashMap::new())), users_per_game: oj_rc_core::ConfigProvider::<()>::players_per_game(conf), is_enabled: mp_settings.is_enabled, + is_parties_enabled: server_conf.allow_parties, hostname: domain.to_owned(), hostport: port_str.parse().expect("Invalid redirect port"), network_conf: crate::data::network::NetworkConfigData::from_conf(oj_rc_core::ConfigProvider::<()>::network_config(conf)), factory, cpu_counter, weapon_guesser, - change_strategy: GamemodeChangeStrategy::from_core(>::server_config(conf).queue_mode), + change_strategy: GamemodeChangeStrategy::from_core(server_conf.queue_mode), autostart_after: mp_settings.lobby_autostart_after, autostart_task_started: std::sync::atomic::AtomicBool::new(false), team_choosers: std::sync::Arc::new(team_choosers), @@ -623,6 +626,15 @@ impl QueueHandler { }); return; } + if let Some(platoon_info) = &platoon { + if platoon_info.total != 1 && !self.is_parties_enabled { + event_emitter.emit(crate::events::enqueue_error::QueueJoinError { + code: oj_rc_core::data::error_codes::LobbyReasonCode::PartyNotAllowed as i16, + text: "Platoons are not enabled".to_owned(), + }); + return; + } + } self.ensure_autostart_task_running();