# `Cauldron2D.World.Events`
[🔗](https://github.com/jaman/cauldron/blob/v0.1.3/cauldron_2d/lib/cauldron_2d/world/events.ex#L1)

A world's events, told each tick to processes that are not its players — a
recorder, a referee, a bot that reads the game without playing it.

    Cauldron2D.World.Events.subscribe(world)
    receive do
      {:cauldron_events, world, tick, events} -> ...
    end

A subscriber gets one message per tick that had events, with the same list the
players get in their frames, until it unsubscribes or exits; `world` is the world's
pid, and `subscribe/1` takes a pid or a registered name.

# `broadcast`

```elixir
@spec broadcast(pid(), non_neg_integer(), list()) :: :ok
```

Tell `world`'s subscribers the tick's events; nothing is sent for an empty list.

# `subscribe`

```elixir
@spec subscribe(GenServer.server()) :: :ok | {:error, :no_such_world}
```

Receive `world`'s events in the calling process.

# `unsubscribe`

```elixir
@spec unsubscribe(GenServer.server()) :: :ok
```

Stop receiving them.

---

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