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

Make enemy and teammate count customizable

This commit is contained in:
NG (Graham)
2025-06-02 20:08:25 -04:00
parent 36a58eaed1
commit d0c2b1ec03
11 changed files with 98 additions and 40 deletions

View File

@@ -304,9 +304,8 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
}
}
fn singleplayer_vehicles(&self) -> Vec<crate::persist::garage::PrefabVehicle> {
// FIXME don't use serializable types in traits
self.battle.singleplayer.vehicles.clone()
fn singleplayer_details(&self) -> super::SingleplayerConfig {
self.battle.singleplayer.into_singleplayer_conf()
}
/*async fn prefab_vehicles(&self, user: &(dyn crate::persist::user::User<C> + Sync), factory: &crate::factory::Factory) -> Typed<C> {

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};
pub use traits::{ConfigProvider, CompleteCampaignProvider, DevMessageProvider, ServerConfig, GarageUpgrades, GarageUpgradeIncrement, ChatSystemConfig, GameEventSequence, GameEvents, GameRotationStrategy, GameEvent, GameMap, GameVisibility, GameType, SingleplayerConfig, VehicleInfo, VehicleDescriptor};
pub type ConfigImpl = CubeConfig;

View File

@@ -26,7 +26,7 @@ pub trait ConfigProvider<C: Clone> {
fn chat_system_config(&self) -> ChatSystemConfig;
fn gamemode_events(&self) -> GameEventSequence;
// FIXME don't use serializable types in traits
fn singleplayer_vehicles(&self) -> Vec<crate::persist::garage::PrefabVehicle>;
fn singleplayer_details(&self) -> SingleplayerConfig;
}
pub struct CompleteCampaignProvider {
@@ -259,3 +259,32 @@ pub enum GameType {
TeamDeathmatch,
Campaign,
}
#[derive(Clone, Debug)]
pub struct SingleplayerConfig {
pub max_teammates: u32,
pub max_enemies: u32,
pub vehicles: Vec<VehicleInfo>,
}
#[derive(Clone, Debug)]
pub struct VehicleInfo {
pub name: Option<String>,
pub username: String,
pub id: VehicleDescriptor,
}
#[derive(Clone, Debug)]
pub enum VehicleDescriptor {
Factory {
factory: u32,
},
Database {
garage: u32,
},
Raw {
cube_data: Vec<u8>,
colour_data: Vec<u8>,
}
// TODO File
}