LineOfSightModel.new()
Type | function |
Library | wattageTileEngine.LineOfSightModel.* |
Return value | LineOfSightModel |
Keywords | |
See also |
Overview
This function creates a new instance of LineOfSightModel.
Syntax
LineOfSightModel.new( params )
params (required)
Table. Contains all required inputs. See Required Properties below.
Required Properties
The params
table contains the following properties:
radius (required)
Number. Maximum radius of the line of sight.
isTransparent (required)
function. Callback which returns true if the tile is transparent. The callback must have the following signature:
boolean function(column, row)
Examples
local TileEngine = require "plugin.wattageTileEngine"
-- Callback to indicate whether line of sight can pass through tile
local function isTransparent(column, row)
-- Make an opaque wall along column 5
return column ~= 5
end
local lineOfSightModel = TileEngine.LineOfSightModel.new({
radius = 15,
isTransparent = isTransparent
})