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? |
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? |
trap_at (x, y) | What kind of trap (if any) is here? |
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?
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
- trap_at (x, y)
-
What kind of trap (if any) is here?
Parameters:
- x int
- y int
Returns:
-
string or nil
The base trap name or nil. Here the base name doesn't
include the word "trap" and is the same string passed to the c_trap_is_safe() hook.
- withheld (x, y)
-
Is this square excluded from movement by mesmerise-like effects?
Parameters:
- x int
- y int
Returns:
-
boolean