# `QuakeServer.Physics.Command`
[🔗](https://github.com/jaman/quake_server/blob/v0.1.0/lib/quake_server/physics/command.ex#L1)

A player's command run by a program that defines `SV_RunClientCommand`, as FTE runs
one when it arrives (`SV_RunFullQCMovement`, then `SV_PostRunCmd`): the `input_`
globals are set from the command; unless the server is fixing the player's view
(`fixangle`), `v_angle` and `movement` are too; the button fields and `impulse` are set;
the velocity is bounded; while alive, the body turns to the view (a third of the pitch)
and rolls with sideways speed; then `PlayerPreThink`, the player's think and
`SV_RunClientCommand` run, and `PlayerPostThink` and the missile it spawned (`newmis`)
after. When the program turned the view itself, the new view angles are kept for the
client in the server's `ext.setangle`. The player is from then on left out of the
physics frames (`QuakeServer.Physics.independent?/2`).

    server = QuakeServer.Physics.Command.run(server, 1, command)

A command is `%{angles:, forward:, side:, up:, buttons:, impulse:, msec:}`, with an
optional `sequence:`: the view angles in degrees (sent as 16-bit angles), the moves in
units a second, the buttons as bits (bit 0 `button0`, bit 1 `button2`, bits 2 to 7
`button3` to `button8`, bit 8 `buttonuse`, bit 9 `buttonchat`, bit 10 `cursor_active`,
bits 11 to 18 `button9` to `button16`), the time it covers in milliseconds, and the
client's number for it (the `input_sequence` global, 0 when not given). The program's
`time` is the server's host clock throughout.

# `program_moves?`

```elixir
@spec program_moves?(QuakeServer.Server.t()) :: boolean()
```

Whether `server`'s program runs its players' commands itself.

# `run`

```elixir
@spec run(QuakeServer.Server.t(), non_neg_integer(), map(), keyword()) ::
  QuakeServer.Server.t()
```

Run `command` for player entity `entity`, marking it as running its own commands unless
`independent?: false` is given (a physics frame re-running the last command for a
player that has sent none yet); nothing until a player has connected.

---

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