FovROT Class
Represents a FovROT in the game map. requires ROT.js
Constructor
Item Index
Methods
Methods
directionStringToArray
-
direction
Converts a string direction to an rot direction
Parameters:
-
direction
String- Direction of fov (used as default) (not used for fieldRange 360) valid directions: ['up', 'down', 'left', 'right', 'up_left', 'up_right', 'down_left', 'down_right'].
Returns:
[x, y]
entityCanSeeThrough
-
entity
Checks if a tile blocks line of sight
Parameters:
-
entity
Entity- The entity to make a callback for.
Returns:
get
-
x
-
y
Retrieves the visibility of the tile at given coords
Parameters:
-
x
Number- The map coord position to get FovROT visibility from.
-
y
Number- The map coord position to get FovROT visibility from.
Returns:
setMapTileVisible
-
x
-
y
-
range
-
visibility
Sets the visibility of a checked map tile
Parameters:
-
x
Number- The map coord position to set.
-
y
Number- The map coord position to set.
-
range
Number- The distance from this fov origin.
-
visibility
Number- The visibility of this tile coord.
setSize
-
width
-
height
Sets the size of the map to mange fovROT within.
Parameters:
-
width
Number- Width of current map in tiles.
-
height
Number- Height of current map in tiles.
update
-
x
-
y
-
[fieldRange
-
[direction
-
[maxViewDistance
-
[entity]
Calculates the fovROT data relative to given coords.
Parameters:
-
x
Number- The map coordinate position to calculate FovROT from on the x axis.
-
y
Number- The map coordinate position to calculate FovROT from on the y axis.
-
[fieldRange
Number= this.fieldRange || 360] - Field Range of view 90, 180, or 360.
-
[direction
String | ROT.DIRS8.x= this.direction || 'up'] - Direction of fov (not used for fieldRange 360) valid directions: ['up', 'down', 'left', 'right', 'up_left', 'up_right', 'down_left', 'down_right'];.
-
[maxViewDistance
Number= this.maxViewDistance] - Max visible distance in tiles.
-
[entity]
Entity optional- The entity to check tile visibility with.
validateFieldRange
-
fieldRange
Validates a fieldRange value.
Parameters:
-
fieldRange
Number- Field Range of view valid values:
90
,180
, or360
.
- Field Range of view valid values:
Properties
direction
String
Direction of fov (used as default) (not used for fieldRange 360) valid directions: ['up', 'down', 'left', 'right', 'up_left', 'up_right', 'down_left', 'down_right'].
fieldRange
Number
Field Range of view 90, 180, or 360.
maxViewDistance
Number
Max visible distance in tiles
visibleTileKeys
Array
private
Array of visible tile keys used to prevent duplicates in this.visibleTiles.
visibleTiles
Array
All visible map tiles Array of objects: {x: null, y: null, tile: null, range: null}