One level being played: the sectors and sides as they are now, every thing in it, the players, the sector machinery at work, and the random draw everything shares.
A world is a plain value changed by pure functions; ElixirDoom.Game drives it a tic
at a time. Its geometry, map, never changes; sectors and sides do, as floors move
and switches flip. Things are mobjs, keyed by id; players key a player's state by
their id in the game, each holding the id of the thing they move as.
Summary
Functions
How many world units one unit of audio distance is.
Add amount to total key.
Thing id, or nil once it is gone.
A world for level, its map's blockmap and sound index built.
The geometry and live sectors in the shape Cauldron2D.Sectors.Move takes.
Replace a thing, keeping the blockmap in step with where it is.
The next draw from the random table, 0..255.
The difference of two random draws, -255..255, as Doom spreads shots and turns.
Remove thing id from the world.
Sector index as it is now.
A sound heard at a thing's position, or everywhere when at is nil.
The setting key of the world's tuning.
Apply fun to thing id if it is still there.
Replace sector index with fun.(sector).
Types
@type t() :: %ElixirDoom.World{ blockmap: term(), busy: term(), events: term(), exit: term(), level: term(), map: term(), mobjs: term(), next_id: term(), noise: term(), players: term(), rnd: term(), sectors: term(), sides: term(), skill: term(), sky: term(), starts: term(), targets: term(), thinkers: term(), tic: term(), totals: term(), tuning: term(), used: term() }
Functions
@spec audio_scale() :: float()
How many world units one unit of audio distance is.
Add amount to total key.
Thing id, or nil once it is gone.
@spec new(ElixirDoom.Level.t(), keyword()) :: t()
A world for level, its map's blockmap and sound index built.
The geometry and live sectors in the shape Cauldron2D.Sectors.Move takes.
Replace a thing, keeping the blockmap in step with where it is.
The next draw from the random table, 0..255.
The difference of two random draws, -255..255, as Doom spreads shots and turns.
Remove thing id from the world.
@spec sector(t(), non_neg_integer()) :: map()
Sector index as it is now.
A sound heard at a thing's position, or everywhere when at is nil.
The setting key of the world's tuning.
Apply fun to thing id if it is still there.
@spec update_sector(t(), non_neg_integer(), (map() -> map())) :: t()
Replace sector index with fun.(sector).