[wip] im tired boss

This commit is contained in:
2025-08-30 15:49:55 -04:00
parent 5e33e33cce
commit 782dd738cc
5 changed files with 155 additions and 127 deletions

View File

@@ -1,17 +1,11 @@
import { Elysia, t } from "elysia";
import {
getSimplePlayerView,
SimpleAction,
SimpleConfiguration,
SimpleGameState,
} from "@games/shared/games/simple";
import dayjs from "dayjs";
import db from "./db";
import { liveTable, WsOut, WsIn } from "./table";
import { Game } from "@games/shared/games";
import { Human } from "@prisma/client";
import dayjs from "dayjs";
import { Elysia, t } from "elysia";
import { combine } from "kefir";
import Bus from "kefir-bus";
import { Game } from "@games/shared/games";
import db from "./db";
import { liveTable, WsIn, WsOut } from "./table";
export const WS = Bus<
{
@@ -96,18 +90,14 @@ const api = new Elysia({ prefix: "/api" })
presence: "joined",
});
table.outputs.playersPresent.onValue((players) =>
send({ players })
Object.entries(table.outputs.global).forEach(([type, stream]) =>
stream.onValue((v) => send({ [type]: v }))
);
table.outputs.playersReady
.skipDuplicates()
.onValue((readys) => send({ playersReady: readys }));
combine(
[table.outputs.gameState],
[table.outputs.gameImpl],
(state, { game: Game }) =>
state && game.getView({ config, state, humanKey })
(state, game: Game) => state && game.getView({ state, humanKey })
)
.toProperty()
.onValue((view) => send({ view }));