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:
1 parent
cd45c22d0b
commit
37cbc8d85f
24 files changed
+902
-149
No files matched your search
@@ -0,0 +1,58 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "games")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub creation_time: i64, // seconds since unix epoch
|
||||
pub guid: i64,
|
||||
pub map: String,
|
||||
pub mode: GameMode,
|
||||
pub visibility: MapVisibility,
|
||||
pub auto_heal: bool,
|
||||
pub variant: GameType,
|
||||
pub is_complete: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::multiplayer_game_player::Entity")]
|
||||
Player,
|
||||
}
|
||||
|
||||
impl Related<super::multiplayer_game_player::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Player.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(rs_type = "String", db_type = "String(StringLen::None)", rename_all = "PascalCase")]
|
||||
pub enum GameMode {
|
||||
BattleArena,
|
||||
SuddenDeath,
|
||||
Pit,
|
||||
TestMode,
|
||||
SinglePlayer,
|
||||
TeamDeathmatch,
|
||||
Campaign,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(rs_type = "String", db_type = "String(StringLen::None)", rename_all = "PascalCase")]
|
||||
pub enum MapVisibility {
|
||||
Good,
|
||||
Poor,
|
||||
Bad,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(rs_type = "String", db_type = "String(StringLen::None)", rename_all = "PascalCase")]
|
||||
pub enum GameType {
|
||||
Standard,
|
||||
Ranked,
|
||||
Custom,
|
||||
}
|
||||
Reference in new issue
Block a user