insert shuffled wall
This commit is contained in:
parent
3ca8574a6e
commit
d7d567b0e6
7 changed files with 36 additions and 17 deletions
|
|
@ -1,4 +1,6 @@
|
|||
use spacetimedb::{reducer, table, Identity, ReducerContext};
|
||||
use spacetimedb::{Identity, ReducerContext, Table, rand::Rng, reducer, table};
|
||||
|
||||
use jong::tile::Tile;
|
||||
|
||||
#[table(name = player, public)]
|
||||
pub struct Player {
|
||||
|
|
@ -10,7 +12,7 @@ pub struct Player {
|
|||
|
||||
#[table(name = wall)]
|
||||
pub struct Wall {
|
||||
tiles: Vec<()>
|
||||
tiles: Vec<Tile>,
|
||||
}
|
||||
|
||||
#[reducer(init)]
|
||||
|
|
@ -45,7 +47,15 @@ pub fn set_name(ctx: &ReducerContext, name: String) -> Result<(), String> {
|
|||
}
|
||||
|
||||
#[reducer]
|
||||
pub fn shuffle_wall(ctx: &ReducerContext) {}
|
||||
pub fn shuffle_wall(ctx: &ReducerContext) {
|
||||
let mut rng = ctx.rng();
|
||||
let mut tiles: Vec<Tile> = todo();
|
||||
|
||||
// rng.fill();
|
||||
// let tiles = rng.sh;
|
||||
|
||||
ctx.db.wall().insert(Wall {tiles});
|
||||
}
|
||||
|
||||
// #[reducer]
|
||||
// pub fn add(ctx: &ReducerContext, name: String) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue