mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Allow two or more people to load into the same multiplayer match #30
This commit is contained in:
@@ -118,6 +118,32 @@ impl GameMode {
|
||||
crate::persist::config::GameType::Campaign => Self::Campaign,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn from_db(mode: oj_rc_database::schema::multiplayer_game::GameMode) -> Self {
|
||||
match mode {
|
||||
oj_rc_database::schema::multiplayer_game::GameMode::BattleArena => Self::BattleArena,
|
||||
oj_rc_database::schema::multiplayer_game::GameMode::SuddenDeath => Self::SuddenDeath,
|
||||
oj_rc_database::schema::multiplayer_game::GameMode::Pit => Self::Pit,
|
||||
oj_rc_database::schema::multiplayer_game::GameMode::TestMode => Self::TestMode,
|
||||
oj_rc_database::schema::multiplayer_game::GameMode::SinglePlayer => Self::SinglePlayer,
|
||||
oj_rc_database::schema::multiplayer_game::GameMode::TeamDeathmatch => Self::TeamDeathmatch,
|
||||
oj_rc_database::schema::multiplayer_game::GameMode::Campaign => Self::Campaign,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn to_db(&self) -> oj_rc_database::schema::multiplayer_game::GameMode {
|
||||
match self {
|
||||
Self::BattleArena => oj_rc_database::schema::multiplayer_game::GameMode::BattleArena,
|
||||
Self::SuddenDeath => oj_rc_database::schema::multiplayer_game::GameMode::SuddenDeath,
|
||||
Self::Pit => oj_rc_database::schema::multiplayer_game::GameMode::Pit,
|
||||
Self::TestMode => oj_rc_database::schema::multiplayer_game::GameMode::TestMode,
|
||||
Self::SinglePlayer => oj_rc_database::schema::multiplayer_game::GameMode::SinglePlayer,
|
||||
Self::TeamDeathmatch => oj_rc_database::schema::multiplayer_game::GameMode::TeamDeathmatch,
|
||||
Self::Campaign => oj_rc_database::schema::multiplayer_game::GameMode::Campaign,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
@@ -137,4 +163,22 @@ impl MapVisibility {
|
||||
crate::persist::config::GameVisibility::Bad => Self::Bad,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn from_db(mode: oj_rc_database::schema::multiplayer_game::MapVisibility) -> Self {
|
||||
match mode {
|
||||
oj_rc_database::schema::multiplayer_game::MapVisibility::Good => Self::Good,
|
||||
oj_rc_database::schema::multiplayer_game::MapVisibility::Poor => Self::Poor,
|
||||
oj_rc_database::schema::multiplayer_game::MapVisibility::Bad => Self::Bad,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn to_db(&self) -> oj_rc_database::schema::multiplayer_game::MapVisibility {
|
||||
match self {
|
||||
Self::Good => oj_rc_database::schema::multiplayer_game::MapVisibility::Good,
|
||||
Self::Poor => oj_rc_database::schema::multiplayer_game::MapVisibility::Poor,
|
||||
Self::Bad => oj_rc_database::schema::multiplayer_game::MapVisibility::Bad,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ pub struct PlayerData {
|
||||
pub tier: i32,
|
||||
pub robot_name: String,
|
||||
pub robot_map: Vec<u8>,
|
||||
// -- unused i32 here --
|
||||
pub group: Option<String>, // unused i32 too???
|
||||
pub team: i32,
|
||||
pub has_premium: bool,
|
||||
pub robot_uuid: String,
|
||||
@@ -70,7 +70,7 @@ impl PlayerData {
|
||||
(Typed::Str("spawnEffect".into()), Typed::Str(self.spawn_effect.clone().into())),
|
||||
(Typed::Str("deathEffect".into()), Typed::Str(self.death_effect.clone().into())),
|
||||
//(Typed::Str("groupId".into()), Typed::Int(self.group)), // FIXME
|
||||
(Typed::Str("groupId".into()), Typed::Int(self.team)), // not strongly enforced in EnterBattleEventListener
|
||||
(Typed::Str("groupId".into()), Typed::Str(self.group.clone().unwrap_or_default().into())),
|
||||
(Typed::Str("team".into()), Typed::Int(self.team)), // not strongly enforced in EnterBattleEventListener (but has to be parsable into an i32)
|
||||
(Typed::Str("hasPremium".into()), Typed::Bool(self.has_premium)),
|
||||
(Typed::Str("weaponOrder".into()), Typed::IntArr(self.weapon_order.clone().into())),
|
||||
|
||||
Reference in New Issue
Block a user