mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Implement non-event part of singleplayer for #7
This commit is contained in:
1 parent
792585a031
commit
67c14fe80a
35 files changed
+2127
-17
No files matched your search
@@ -6,6 +6,8 @@ use serde::{Serialize, Deserialize};
|
||||
pub struct BattleConfig {
|
||||
pub regen: AutoRegenHealth,
|
||||
pub votes: HashMap<Vote, Vec<VoteThreshold>>,
|
||||
#[serde(default = "default_game_modes")]
|
||||
pub games: GameModes,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
@@ -60,3 +62,70 @@ impl std::convert::Into<crate::data::voting::Vote> for Vote {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Copy)]
|
||||
pub struct GameMode {
|
||||
pub respawn_heal_duration: f32,
|
||||
pub respawn_full_heal_duration: f32,
|
||||
pub kill_limit: i32,
|
||||
pub game_time_m: i32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::game_mode::GameModeConfig> for GameMode {
|
||||
fn into(self) -> crate::data::game_mode::GameModeConfig {
|
||||
crate::data::game_mode::GameModeConfig {
|
||||
respawn_heal_duration: self.respawn_heal_duration,
|
||||
respawn_full_heal_duration: self.respawn_full_heal_duration,
|
||||
kill_limit: self.kill_limit,
|
||||
game_time_minutes: self.game_time_m,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Copy)]
|
||||
pub struct GameModes {
|
||||
pub battle_arena: GameMode,
|
||||
pub elimination: GameMode,
|
||||
pub pit: GameMode,
|
||||
pub team_deathmatch: GameMode,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::game_mode::GameModeConfigs> for GameModes {
|
||||
fn into(self) -> crate::data::game_mode::GameModeConfigs {
|
||||
crate::data::game_mode::GameModeConfigs {
|
||||
battle_arena: self.battle_arena.into(),
|
||||
elimination: self.elimination.into(),
|
||||
the_pit: self.pit.into(),
|
||||
team_deathmatch: self.team_deathmatch.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn default_game_modes() -> GameModes {
|
||||
GameModes {
|
||||
battle_arena: GameMode {
|
||||
respawn_heal_duration: 10.0,
|
||||
respawn_full_heal_duration: 10.0,
|
||||
kill_limit: 0,
|
||||
game_time_m: 20,
|
||||
},
|
||||
elimination: GameMode {
|
||||
respawn_heal_duration: 10.0,
|
||||
respawn_full_heal_duration: 10.0,
|
||||
kill_limit: 10,
|
||||
game_time_m: 10,
|
||||
},
|
||||
pit: GameMode {
|
||||
respawn_heal_duration: 20.0,
|
||||
respawn_full_heal_duration: 20.0,
|
||||
kill_limit: 15,
|
||||
game_time_m: 15,
|
||||
},
|
||||
team_deathmatch: GameMode {
|
||||
respawn_heal_duration: 10.0,
|
||||
respawn_full_heal_duration: 10.0,
|
||||
kill_limit: 10,
|
||||
game_time_m: 10,
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user