extract player tables

This commit is contained in:
Tao Tien 2026-02-11 10:14:02 -08:00
parent 7cef787f38
commit 71ad4cada6
5 changed files with 49 additions and 44 deletions

View 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 },
}