# `Cauldron2D.Drafter.Client.Seats`
[🔗](https://github.com/jaman/cauldron/blob/v0.2.2/cauldron_2d_drafter/lib/cauldron_2d/drafter/client/seats.ex#L1)

The further players a client plays on the same machine, from the game's
`local_seats/1`: each a player of the world with its own keys and its own controller.

A seat is `%{id, input, pad, last_input}`. Seats join the world with `frames: false`,
so the client receives frames only as its own player; each key event reaches every
seat's input and counts where that seat's keymap binds it; a controller event reaches
the one seat it is routed to. `send_input/3` sends a seat's input only when it changed.

# `seat`

```elixir
@type seat() :: %{
  id: String.t(),
  input: Cauldron2D.Input.t(),
  pad: Cauldron2D.Input.Pad.t(),
  last_input: map() | nil
}
```

# `controller`

```elixir
@spec controller([seat()], non_neg_integer(), map()) :: [seat()]
```

Seat `index` (counting from `0`) after a controller event.

# `expire`

```elixir
@spec expire([seat()], integer()) :: [seat()]
```

Every seat's input with its timed holds expired at `now`.

# `join`

```elixir
@spec join(
  GenServer.server(),
  String.t(),
  map(),
  [Cauldron2D.Input.keymap()],
  Cauldron2D.Input.Pad.padmap(),
  keyword()
) :: [seat()]
```

The seats `keymaps` describe, joined to `world` as `"<username> 2"` and on. A seat
the world refuses is left out. `props` are the player's own join props, given to each
seat with its own `:username` and with `:seat_of`, the player's own username, so the
world can tell whose seat it is; `input_options` are those of the player's own input.

# `key`

```elixir
@spec key([seat()], term(), integer()) :: [seat()]
```

Every seat's input after a key or pointer event at `now`.

# `leave`

```elixir
@spec leave([seat()], GenServer.server()) :: :ok
```

Every seat out of `world`.

# `release`

```elixir
@spec release([seat()], [Cauldron2D.Input.keymap()], keyword()) :: [seat()]
```

Every seat holding nothing, its keys read by the keymap it had.

# `send_input`

```elixir
@spec send_input([seat()], GenServer.server(), (map() -&gt; map())) :: [seat()]
```

Every seat whose input changed sent to `world`, its read input passed through `steer`
first, as the client steers its own player's.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
