Safe Haskell | None |
---|
Operations concerning dungeon level tiles.
Unlike for many other content types, there is no type Tile
,
of particular concrete tiles in the dungeon,
corresponding to TileKind
(the type of kinds of terrain tiles).
This is because the tiles are too numerous and there's not enough
storage space for a well-rounded Tile
type, on one hand,
and on the other hand, tiles are accessed
too often in performance critical code
to try to compress their representation and/or recompute them.
Instead, of defining a Tile
type, we express various properties
of concrete tiles by arrays or sparse IntMaps, as appropriate.
Actors at normal speed (2 m/s) take one turn to move one tile (1 m by 1 m).
- type SecretTime = Time
- type SmellTime = Time
- kindHasFeature :: Feature -> TileKind -> Bool
- kindHas :: [Feature] -> [Feature] -> TileKind -> Bool
- hasFeature :: Ops TileKind -> Feature -> Id TileKind -> Bool
- isClear :: Ops TileKind -> Id TileKind -> Bool
- isLit :: Ops TileKind -> Id TileKind -> Bool
- isExplorable :: Ops TileKind -> Id TileKind -> Bool
- similar :: TileKind -> TileKind -> Bool
- canBeHidden :: Ops TileKind -> TileKind -> Bool
- speedup :: Ops TileKind -> Speedup TileKind
Documentation
type SecretTime = TimeSource
The time interval needed to discover a given secret, e.g., a hidden terrain tile, e.g., a hidden door.
The last time a hero left a smell in a given tile. To be used by monsters that hunt by smell.
kindHasFeature :: Feature -> TileKind -> BoolSource
Whether a tile kind has the given feature.
kindHas :: [Feature] -> [Feature] -> TileKind -> BoolSource
Whether a tile kind has all features of the first set and no features of the second.
hasFeature :: Ops TileKind -> Feature -> Id TileKind -> BoolSource
Whether a tile kind (specified by its id) has the given feature.
isClear :: Ops TileKind -> Id TileKind -> BoolSource
Whether a tile does not block vision. Essential for efficiency of FOV, hence tabulated.
isLit :: Ops TileKind -> Id TileKind -> BoolSource
Whether a tile is lit on its own. Essential for efficiency of Perception, hence tabulated.
isExplorable :: Ops TileKind -> Id TileKind -> BoolSource
Whether a tile can be explored, possibly yielding a treasure or a hidden message. We exclude doors and hidden features (TODO: and features created by actors, e.g., dug out).