public/js-roguelike-skeleton/src/fov-rot.js
function(x, y, fieldRange, direction, maxViewDistance, entity){

            if(fieldRange === void 0){
                fieldRange = this.fieldRange;
            }

            if(direction === void 0){
                direction = this.direction;
            }

            if(fieldRange !== 360 && typeof direction === 'string'){
                direction = this.directionStringToArray(direction);
            }
            this.direction = direction;
            if(maxViewDistance === void 0){
                maxViewDistance = this.maxViewDistance;
            }

            this.validateFieldRange(fieldRange);

            this.visibleTiles = [];
            this.visibleTileKeys = [];
            this.fovMap.reset();
            var entityCanSeeThrough = this.getEntityCanSeeThroughCallback(entity);
            var fov = new ROT.FOV.RecursiveShadowcasting(entityCanSeeThrough);

            var setMapTileVisible = this.setMapTileVisible.bind(this);

            if(fieldRange === 360){
                fov.compute(x, y, maxViewDistance, setMapTileVisible);
            }
            else {
                if(fieldRange === 180){
                    fov.compute180(x, y, maxViewDistance, direction, setMapTileVisible);
                }
                else if(fieldRange === 90){
                    fov.compute90(x, y, maxViewDistance, direction, setMapTileVisible);
                }
            }
        }
function(x, y, fieldRange, direction, maxViewDistance, entity){

            if(fieldRange === void 0){
                fieldRange = this.fieldRange;
            }

            if(direction === void 0){
                direction = this.direction;
            }

            if(fieldRange !== 360 && typeof direction === 'string'){
                direction = this.directionStringToArray(direction);
            }
            this.direction = direction;
            if(maxViewDistance === void 0){
                maxViewDistance = this.maxViewDistance;
            }

            this.validateFieldRange(fieldRange);

            this.visibleTiles = [];
            this.visibleTileKeys = [];
            this.fovMap.reset();
            var entityCanSeeThrough = this.getEntityCanSeeThroughCallback(entity);
            var fov = new ROT.FOV.RecursiveShadowcasting(entityCanSeeThrough);

            var setMapTileVisible = this.setMapTileVisible.bind(this);

            if(fieldRange === 360){
                fov.compute(x, y, maxViewDistance, setMapTileVisible);
            }
            else {
                if(fieldRange === 180){
                    fov.compute180(x, y, maxViewDistance, direction, setMapTileVisible);
                }
                else if(fieldRange === 90){
                    fov.compute90(x, y, maxViewDistance, direction, setMapTileVisible);
                }
            }
        }
function ( x , y , fieldRange , direction , maxViewDistance , entity ) { if ( fieldRange === void 0 ) { fieldRange = this . fieldRange ; } if ( direction === void 0 ) { direction = this . direction ; } if ( fieldRange !== 360 && typeof direction === 'string' ) { direction = this . directionStringToArray ( direction ) ; } this . direction = direction ; if ( maxViewDistance === void 0 ) { maxViewDistance = this . maxViewDistance ; } this . validateFieldRange ( fieldRange ) ; this . visibleTiles = [ ] ; this . visibleTileKeys = [ ] ; this . fovMap . reset ( ) ; var entityCanSeeThrough = this . getEntityCanSeeThroughCallback ( entity ) ; var fov = new ROT . FOV . RecursiveShadowcasting ( entityCanSeeThrough ) ; var setMapTileVisible = this . setMapTileVisible . bind ( this ) ; if ( fieldRange === 360 ) { fov . compute ( x , y , maxViewDistance , setMapTileVisible ) ; } else { if ( fieldRange === 180 ) { fov . compute180 ( x , y , maxViewDistance , direction , setMapTileVisible ) ; } else if ( fieldRange === 90 ) { fov . compute90 ( x , y , maxViewDistance , direction , setMapTileVisible ) ; } } }
Calculates the fovROT data relative to given coords.
@method update
@param {Number} x - The map coordinate position to calculate FovROT from on the x axis.
@param {Number} y - The map coordinate position to calculate FovROT from on the y axis.
@param {Number} [fieldRange = this.fieldRange || 360] - Field Range of view 90, 180, or 360.
@param {String|ROT.DIRS[8].x} [direction = 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'];.
@param {Number} [maxViewDistance = this.maxViewDistance] - Max visible distance in tiles.
@param {Entity} [entity] - The entity to check tile visibility with.
Calculates the fovROT data relative to given coords .