Type function
Library wattageTileEngine.Module.*
Return value Module
See also  


This function creates a new instance of type Module.

Syntax params )
params (required)

Table. Contains all required inputs. See Required Properties below.

Required Properties

The params table contains the following properties:

name (required)

String. Name of the module.

rows (required)

Number. Number of rows in the module.

columns (required)

Number. Number of columns in the module.

lightingModel (required)

LightingModel. LightingModel for the module.

losModel (required)

LineOfSightModel. LineOfSightModel for the module.


local TileEngine = require "plugin.wattageTileEngine"

-- Callback to indicate whether a tile is transparent
local function isTransparent(column, row)
    -- Make an opaque wall along column 5
    return column ~= 5

-- Callback to indicate whether a tile is affected by ambient lighting.
local function isTileAffectedByAmbient(row, column)
    -- Make all tiles affected by ambient lighting
    return true

local lightingModel ={
    isTransparent = isTransparent,
    isTileAffectedByAmbient = isTileAffectedByAmbient,
    useTransitioners = true

local lineOfSightModel ={
    radius = 15,
    isTransparent = isTransparent

local myModule ={
    name = "myModule",
    rows = 100,
    columns = 100,
    lightingModel = lightingModel,
    losModel = lineOfSightModel