diff --git a/internal/sim/player.go b/internal/sim/player.go index 59479cf..e4a3dbb 100644 --- a/internal/sim/player.go +++ b/internal/sim/player.go @@ -66,6 +66,13 @@ func (p *player) readLoop(c chan Request, conn *websocket.Conn) { if err != nil { p.Error("read error: %v", err) conn.Close() + c <- Request{ + From: p.name, + Wants: effect(func(w *world, r *room, p *player, seq int) result { + r.removePlayer(p.name) + return result{} + }), + } p.stop <- false return }