ElixirDoom.Specials.Machines (elixir_doom v0.1.0)

Copy Markdown View Source

The world's running machines — movers, lights, switch timers — kept as Cauldron2D.Thinkers, and which sectors a mover has taken. A sector taken by one mover is not given to another until the first is released.

Summary

Functions

Whether a mover has taken sector.

The mover on sector, as {id, mover}, or nil.

Give sector back once its mover has stopped.

Start thinker.

Start mover on sector, taking the sector.

Replace thinker id with fun.(thinker).

Apply fun to every thinker match? accepts.

Functions

busy?(world, sector)

@spec busy?(ElixirDoom.World.t(), non_neg_integer()) :: boolean()

Whether a mover has taken sector.

mover(world, sector)

@spec mover(ElixirDoom.World.t(), non_neg_integer()) :: {pos_integer(), map()} | nil

The mover on sector, as {id, mover}, or nil.

release(world, sector)

Give sector back once its mover has stopped.

start(world, thinker)

@spec start(ElixirDoom.World.t(), map()) :: ElixirDoom.World.t()

Start thinker.

start_mover(world, sector, mover)

@spec start_mover(ElixirDoom.World.t(), non_neg_integer(), map()) ::
  ElixirDoom.World.t()

Start mover on sector, taking the sector.

update(world, id, fun)

@spec update(ElixirDoom.World.t(), pos_integer(), (map() -> map())) ::
  ElixirDoom.World.t()

Replace thinker id with fun.(thinker).

update_where(world, match?, fun)

@spec update_where(ElixirDoom.World.t(), (map() -> boolean()), (map() -> map())) ::
  ElixirDoom.World.t()

Apply fun to every thinker match? accepts.