Module view
View the world.
All functions in this module that take coordinates use a player centered coordinate system.
Functions
| can_reach (x, y) | Can we get to this square? |
| cell_see_cell (x1, y1, x2, y2) | Can one cell see the other? |
| cell_see_cell_no_trans (x1, y1, x2, y2) | Can one cell see the other without looking through a window? |
| cell_see_cell_solid (x1, y1, x2, y2) | Can one cell see another without something solid in the way? |
| cell_see_cell_solid_see (x1, y1, x2, y2) | Can one cell see another with nothing in the way? |
| cloud_at (x, y) | What kind of cloud (if any) is here? |
| feature_at (x, y) | What is the feature here? |
| get_map () | Returns the entire known map as a table of cell objects. |
| in_known_map_bounds (x, y) | Are the given coordinates in the minimal bounding box of the known map? |
| invisible_monster (x, y) | Did we detect an invisible monster on this square? |
| is_safe_square (x, y, assume_flight) | Is it safe here? |
| seen_at (x, y) | Have we actually seen this location before? |
| withheld (x, y) | Is this square excluded from movement by mesmerise-like effects? |
Functions
- can_reach (x, y)
-
Can we get to this square?
Parameters:
- x int
- y int
Returns:
-
boolean
- cell_see_cell (x1, y1, x2, y2)
-
Can one cell see the other? Can check any two squares in the player's
map knowledge, treating unknown squares as clear. Uses player-centered
coordinates.
Parameters:
- x1 int
- y1 int
- x2 int
- y2 int
Returns:
-
boolean
- cell_see_cell_no_trans (x1, y1, x2, y2)
-
Can one cell see the other without looking through a window? Can check
any two squares in the player's map knowledge, treating unknown squares as
clear. Uses player-centered coordinates.
Parameters:
- x1 int
- y1 int
- x2 int
- y2 int
Returns:
-
boolean
- cell_see_cell_solid (x1, y1, x2, y2)
-
Can one cell see another without something solid in the way? Can check
any two squares in the player's map knowledge, treating unknown squares as
clear. Uses player-centered coordinates.
Parameters:
- x1 int
- y1 int
- x2 int
- y2 int
Returns:
-
boolean
- cell_see_cell_solid_see (x1, y1, x2, y2)
-
Can one cell see another with nothing in the way? Checks line of sight
treating all solid features as opaque and properly checking bushes and
clouds. Can check any two squares in the player's map knowledge, treating
unknown squares as clear. Uses player-centered coordinates.
Parameters:
- x1 int
- y1 int
- x2 int
- y2 int
Returns:
-
boolean
- cloud_at (x, y)
-
What kind of cloud (if any) is here?
Parameters:
- x int
- y int
Returns:
-
string or nil
cloud name or nil
- feature_at (x, y)
-
What is the feature here?
Parameters:
- x int
- y int
Returns:
-
string
feature name
- get_map ()
-
Returns the entire known map as a table of cell objects.
Cells have x, y, feature; optional monster (object);
optional cloud (name); and optional flags [visible, mapped,
traversable, solid, door, undiggable, frontier, excluded, item,
unvisited, unsafe, invisiblemonster, detecteditem, detected_monster].
The frontier flag indicates that the cell is adjacent to an unknown cell.
The key for each cell is 40000*(100+x) + (100+y), which is
a reversible composition of the x,y coordinates (much more efficient
as a key for lua than other options).
Returns:
-
table[cell]
- in_known_map_bounds (x, y)
-
Are the given coordinates in the minimal bounding box of the known map?
Parameters:
- x int
- y int
Returns:
-
boolean
- invisible_monster (x, y)
-
Did we detect an invisible monster on this square?
Parameters:
- x int
- y int
Returns:
-
boolean
- is_safe_square (x, y, assume_flight)
-
Is it safe here? A square is considered unsafe if it has a harmful cloud,
harmful trap, untraversable terrain, a runed door, or is excluded. The
untraversable terrain check is the same as travel.featureistraversable().
Parameters:
- x int
- y int
- assume_flight
boolean
If true, assume the player has permanent
flight.
Returns:
-
boolean
- seen_at (x, y)
-
Have we actually seen this location before? A square that's only magic
mapped or that was forgotten with X->^F doesn't count as seen.
Parameters:
- x int
- y int
Returns:
-
boolean
True if we've actually seen this location, false
otherwise. - withheld (x, y)
-
Is this square excluded from movement by mesmerise-like effects?
Parameters:
- x int
- y int
Returns:
-
boolean