extract player tables
This commit is contained in:
parent
7cef787f38
commit
71ad4cada6
5 changed files with 49 additions and 44 deletions
40
spacetimedb/src/tables/player.rs
Normal file
40
spacetimedb/src/tables/player.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
use spacetimedb::Identity;
|
||||
use spacetimedb::{SpacetimeType, table};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[table(name = player, public)]
|
||||
pub struct Player {
|
||||
#[primary_key]
|
||||
pub identity: Identity,
|
||||
|
||||
#[unique]
|
||||
#[auto_inc]
|
||||
pub id: u32,
|
||||
|
||||
pub name: Option<String>,
|
||||
|
||||
#[index(btree)]
|
||||
pub lobby_id: u32,
|
||||
pub hand_id: u32,
|
||||
pub pond_id: u32,
|
||||
|
||||
pub ready: bool,
|
||||
}
|
||||
|
||||
#[table(name = bot)]
|
||||
pub struct Bot {
|
||||
#[primary_key]
|
||||
#[auto_inc]
|
||||
pub id: u32,
|
||||
|
||||
#[index(btree)]
|
||||
pub lobby_id: u32,
|
||||
pub hand_id: u32,
|
||||
pub pond_id: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, SpacetimeType)]
|
||||
pub enum PlayerOrBot {
|
||||
Player { id: u32 },
|
||||
Bot { id: u32 },
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue