ugs aliases game state, shorter help sentences

main
Bel LaPointe 2024-12-15 11:09:21 -07:00
parent c3e9c18e95
commit 2c3e870750
2 changed files with 7 additions and 3 deletions

View File

@ -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)
}

View File

@ -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.",
}, "<br>"),