From 2c3e8707508738f286a7e09fe7289340a3ea5170 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:09:21 -0700 Subject: [PATCH] ugs aliases game state, shorter help sentences --- cmd/server/game.go | 4 ++++ cmd/server/ws.go | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/server/game.go b/cmd/server/game.go index a47bfe1..60ccd80 100644 --- a/cmd/server/game.go +++ b/cmd/server/game.go @@ -102,3 +102,7 @@ func (ugs *UserGameServer) listen(ctx context.Context, reader func(context.Conte } return ctx.Err() } + +func (ugs *UserGameServer) State(ctx context.Context) (GameState, error) { + return ugs.games.GameState(ctx, ugs.ID) +} diff --git a/cmd/server/ws.go b/cmd/server/ws.go index 372e7d1..cce5c60 100644 --- a/cmd/server/ws.go +++ b/cmd/server/ws.go @@ -31,7 +31,6 @@ func (s *S) serveWS(w http.ResponseWriter, r *http.Request) error { if err != nil { return err } - game := ugs.ID go ugs.Listen(ctx, can, func(ctx context.Context) ([]byte, error) { _, b, err := c.Read(ctx) @@ -39,7 +38,7 @@ func (s *S) serveWS(w http.ResponseWriter, r *http.Request) error { }) for ugs.More(ctx) == nil { - gameState, err := s.games.GameState(ctx, game) + gameState, err := ugs.State(ctx) if err != nil { return err } @@ -49,7 +48,8 @@ func (s *S) serveWS(w http.ResponseWriter, r *http.Request) error { "CARD ASSASSINS (Mobile Ed.)", "", "1. Get any target to say any of his or her kill words.", - "2. Click on the kill word a target said.", + "2. Click the word to collect points.", + "3. Review new kill words.", "", "The game ends when everyone has been assassinated.", }, "
"),