Things — players, monsters, missiles, pickups, decorations — and how each moves and changes state every tic.
{world, id} = ElixirDoom.Mobj.spawn(world, :mt_troop, {x, y, :floor}, angle)
world = ElixirDoom.Mobj.set_state(world, id, :s_troo_run1)
world = ElixirDoom.Mobj.tick(world, id)A thing is a map with its type, position (z its feet), angle in radians, momentum,
size, flags (a set of Doom's MF_ names as atoms), health, state, and the bookkeeping
monsters use to hunt. States come from ElixirDoom.Info and are run by
Cauldron2D.States; their actions by ElixirDoom.Actions.
Summary
Functions
The angle from thing a to b, in radians.
Doom's quick distance: the longer side plus half the shorter.
The body Cauldron2D.Sectors.Move moves for thing mobj.
Thing id, a missile, bursts where it is.
Thing mobj with flag set or cleared.
Whether thing mobj has flag flag.
Thing type mobj's definition.
The movement options for thing mobj.
Put thing id into state name, running its actions; nil removes it.
Spawn a thing of type at {x, y, z}, z a height or :floor or :ceiling.
One tic of thing id: move it, let it fall, count its state down.
Move thing id to point if it fits, picking up what it touches and triggering the
lines it crosses: {:ok, world} or {:blocked, world, why}, why as
Cauldron2D.Sectors.Move.try/4 reports it, with floats?: true where only its height
was wrong.
Functions
The angle from thing a to b, in radians.
Doom's quick distance: the longer side plus half the shorter.
@spec body(map()) :: Cauldron2D.Sectors.Move.body()
The body Cauldron2D.Sectors.Move moves for thing mobj.
@spec explode_missile(ElixirDoom.World.t(), pos_integer()) :: ElixirDoom.World.t()
Thing id, a missile, bursts where it is.
Thing mobj with flag set or cleared.
Whether thing mobj has flag flag.
Thing type mobj's definition.
@spec move_opts(ElixirDoom.World.t(), map()) :: keyword()
The movement options for thing mobj.
@spec set_state(ElixirDoom.World.t(), pos_integer(), atom() | nil) :: ElixirDoom.World.t()
Put thing id into state name, running its actions; nil removes it.
@spec spawn( ElixirDoom.World.t(), atom(), {number(), number(), number() | :floor | :ceiling}, number() ) :: {ElixirDoom.World.t(), pos_integer()}
Spawn a thing of type at {x, y, z}, z a height or :floor or :ceiling.
@spec tick(ElixirDoom.World.t(), pos_integer()) :: ElixirDoom.World.t()
One tic of thing id: move it, let it fall, count its state down.
@spec try_move(ElixirDoom.World.t(), pos_integer(), {number(), number()}) :: {:ok, ElixirDoom.World.t()} | {:blocked, ElixirDoom.World.t(), map()}
Move thing id to point if it fits, picking up what it touches and triggering the
lines it crosses: {:ok, world} or {:blocked, world, why}, why as
Cauldron2D.Sectors.Move.try/4 reports it, with floats?: true where only its height
was wrong.