ElixirQuake.Effects (elixir_quake v0.1.0)

Copy Markdown View Source

What the player's screen shows besides the world: particles and trails, lightning beams, the colour washes of damage, bonuses, power-ups and liquids, the kick of being hit, the pain face, printed messages, the intermission and the closing text.

effects = ElixirQuake.Effects.handle(effects, event, context)
effects = ElixirQuake.Effects.run(effects, seconds, now)

context is %{time:, origin:, angles:}, the player's position and view.

Summary

Functions

Being hurt: armor and blood points taken, from from.

Take in one server event.

The view kick of being hit at now, as {pitch, roll} in degrees.

Move everything on by seconds to now.

The sounds taken in since the last call, oldest first, and the effects without them.

Lay trails behind the moving things that leave them, as {entity, origin, model_flags}.

The colour washes in force, as [{{r, g, b}, percent}], given the player's items and the contents at the eye.

Types

t()

@type t() :: %ElixirQuake.Effects{
  beams: term(),
  bonus: term(),
  center: term(),
  damage: term(),
  finale: term(),
  intermission: term(),
  kick: term(),
  notify: term(),
  pain_until: term(),
  particles: term(),
  pending: term(),
  sounds: term(),
  trails: term()
}

Functions

damage(fx, armor, blood, from, ctx)

@spec damage(t(), number(), number(), Cauldron3D.Vec.t(), map()) :: t()

Being hurt: armor and blood points taken, from from.

handle(fx, arg2, ctx)

@spec handle(t(), term(), map()) :: t()

Take in one server event.

kick(effects, now)

@spec kick(t(), float()) :: {float(), float()}

The view kick of being hit at now, as {pitch, roll} in degrees.

run(fx, seconds, now)

@spec run(t(), float(), float()) :: t()

Move everything on by seconds to now.

take_sounds(fx)

@spec take_sounds(t()) :: {[map()], t()}

The sounds taken in since the last call, oldest first, and the effects without them.

trails(fx, things, now)

@spec trails(t(), [{integer(), Cauldron3D.Vec.t(), integer()}], float()) :: t()

Lay trails behind the moving things that leave them, as {entity, origin, model_flags}.

washes(fx, items, contents)

@spec washes(t(), integer(), integer()) :: [{{byte(), byte(), byte()}, float()}]

The colour washes in force, as [{{r, g, b}, percent}], given the player's items and the contents at the eye.