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:
- 
                    
                        directionString- 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:
- 
                    
                        entityEntity- The entity to make a callback for.
 
Returns:
get
    
        - 
                    
                        x
- 
                    
                        y
Retrieves the visibility of the tile at given coords
Parameters:
- 
                    
                        xNumber- The map coord position to get FovROT visibility from.
 
- 
                    
                        yNumber- The map coord position to get FovROT visibility from.
 
Returns:
setMapTileVisible
    
        - 
                    
                        x
- 
                    
                        y
- 
                    
                        range
- 
                    
                        visibility
Sets the visibility of a checked map tile
Parameters:
- 
                    
                        xNumber- The map coord position to set.
 
- 
                    
                        yNumber- The map coord position to set.
 
- 
                    
                        rangeNumber- The distance from this fov origin.
 
- 
                    
                        visibilityNumber- The visibility of this tile coord.
 
setSize
    
        - 
                    
                        width
- 
                    
                        height
Sets the size of the map to mange fovROT within.
Parameters:
- 
                    
                        widthNumber- Width of current map in tiles.
 
- 
                    
                        heightNumber- Height of current map in tiles.
 
update
    
        - 
                    
                        x
- 
                    
                        y
- 
                    
                        [fieldRange
- 
                    
                        [direction
- 
                    
                        [maxViewDistance
- 
                    
                        [entity]
Calculates the fovROT data relative to given coords.
Parameters:
- 
                    
                        xNumber- The map coordinate position to calculate FovROT from on the x axis.
 
- 
                    
                        yNumber- The map coordinate position to calculate FovROT from on the y axis.
 
- 
                    
                        [fieldRangeNumber= this.fieldRange || 360] - Field Range of view 90, 180, or 360. 
- 
                    
                        [directionString | 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'];. 
- 
                    
                        [maxViewDistanceNumber= this.maxViewDistance] - Max visible distance in tiles. 
- 
                    
                        [entity]Entity optional- The entity to check tile visibility with.
 
validateFieldRange
    
        - 
                    
                        fieldRange
Validates a fieldRange value.
Parameters:
- 
                    
                        fieldRangeNumber- 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}
