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

Add team death match support #33

This commit is contained in:
NG (Graham)
2025-09-14 12:08:52 -04:00
parent d194e29ff7
commit 525fa8b87e
13 changed files with 565 additions and 65 deletions

View File

@@ -259,13 +259,13 @@ fn default_game_modes() -> GameModes {
pit: GameMode {
respawn_heal_duration: 20.0,
respawn_full_heal_duration: 20.0,
kill_limit: 15,
kill_limit: 0,
game_time_m: 15,
},
team_deathmatch: GameMode {
respawn_heal_duration: 10.0,
respawn_full_heal_duration: 0.5,
kill_limit: 10,
kill_limit: 2,
game_time_m: 10,
},
}
@@ -378,7 +378,7 @@ fn default_rotation() -> GameEventSequence {
multiplayer: GameEvent {
map: GameMap::Earth1,
visibility: GameVisibility::Good,
mode: GameType::Pit,
mode: GameType::TeamDeathmatch,
auto_heal: true,
},
duration_s: 5*60, // 5 minutes
@@ -515,6 +515,7 @@ fn default_multiplayer() -> super::MultiplayerConfig {
fakes: super::multiplayer::default_fake_users(),
battle_arena: super::multiplayer::default_ba_conf(),
pit_config: super::multiplayer::default_pit_conf(),
team_death_match: super::multiplayer::default_tdm_conf(),
}
}

View File

@@ -476,4 +476,8 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
fn pit_settings(&self) -> super::PitSettings {
self.battle.multiplayer.pit_config.clone().into()
}
fn tdm_settings(&self) -> super::TeamDeathMatchSettings {
self.battle.multiplayer.team_death_match.clone().into()
}
}

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, QueueChangeMode, Point, Sphere, MapConfig, LinksConfig, FakePlayer, ClientEmulator, EnergyConfig, BattleArenaResolver, PitSettings, PitWinCondition};
pub use traits::{ConfigProvider, CompleteCampaignProvider, DevMessageProvider, ServerConfig, GarageUpgrades, GarageUpgradeIncrement, ChatSystemConfig, GameEventSequence, GameEvents, GameRotationStrategy, GameEvent, GameMap, GameVisibility, GameType, SingleplayerConfig, VehicleInfo, VehicleDescriptor, QueueChangeMode, Point, Sphere, MapConfig, LinksConfig, FakePlayer, ClientEmulator, EnergyConfig, BattleArenaResolver, PitSettings, PitWinCondition, TeamDeathMatchSettings};
pub type ConfigImpl = CubeConfig;

View File

@@ -37,6 +37,7 @@ pub trait ConfigProvider<C: Clone> {
fn energy(&self) -> EnergyConfig;
fn ba_settings(&self) -> BattleArenaResolver;
fn pit_settings(&self) -> PitSettings;
fn tdm_settings(&self) -> TeamDeathMatchSettings;
}
pub struct CompleteCampaignProvider {
@@ -445,3 +446,9 @@ pub enum PitWinCondition {
Damage(u32),
Time,
}
#[derive(Debug)]
pub struct TeamDeathMatchSettings {
pub respawn_time_seconds: u64,
pub self_destruct_is_kill: bool,
}

View File

@@ -12,6 +12,8 @@ pub struct MultiplayerConfig {
pub battle_arena: BattleArenaConfig,
#[serde(default = "default_pit_conf")]
pub pit_config: PitConfig,
#[serde(default = "default_tdm_conf")]
pub team_death_match: TeamDeathMatchConfig,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
@@ -235,3 +237,25 @@ fn default_pit_win_conditions() -> Vec<PitWinCondition> {
PitWinCondition::Time,
]
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct TeamDeathMatchConfig {
pub respawn_time_s: u64,
pub self_destruct_is_kill: bool,
}
impl std::convert::From<TeamDeathMatchConfig> for crate::persist::config::TeamDeathMatchSettings {
fn from(value: TeamDeathMatchConfig) -> Self {
Self {
respawn_time_seconds: value.respawn_time_s,
self_destruct_is_kill: value.self_destruct_is_kill,
}
}
}
pub(super) fn default_tdm_conf() -> TeamDeathMatchConfig {
TeamDeathMatchConfig {
respawn_time_s: default_respawn_time(),
self_destruct_is_kill: true,
}
}