How far a sound carries through a sector map: from the sector it is made in, into every sector joined to it by an opening that is not shut.
index = Cauldron2D.Sectors.Noise.index(map)
Cauldron2D.Sectors.Noise.spread(world, index, sector)
#=> %{12 => 0, 13 => 0, 40 => 1}The result maps each sector the sound reaches to how many sound-blocking lines it
crossed on the way there. A sound crosses one line flagged :blocks_sound and is
stopped by a second, so a game can keep a room quiet behind a pair of them. A closed
door — an opening with no height — stops it entirely.
world is %{map:, sectors:}. index/1 lists each sector's two-sided lines once, to
pass to every spread/3.
Summary
Functions
Each sector's two-sided lines, %{sector => [line_index]}.
The sectors a sound made in sector reaches. See the moduledoc.
Functions
@spec index(Cauldron2D.Sectors.Map.t()) :: %{ required(non_neg_integer()) => [non_neg_integer()] }
Each sector's two-sided lines, %{sector => [line_index]}.
@spec spread( %{map: Cauldron2D.Sectors.Map.t(), sectors: tuple()}, map(), non_neg_integer() ) :: %{ required(non_neg_integer()) => 0 | 1 }
The sectors a sound made in sector reaches. See the moduledoc.