

Open Lights Controller
Open Lights Controller
The mod requires installed Open Computers and Open Lights
Installation
Simply place the mod file into the mods folder of your game.
Available Blocks
- Open Lights Controller (4 block range)
- Open Lights Controller (8 block range)
- Open Lights Controller (16 block range)
- Open Lights Controller Border
Usage
-- Require necessary components
component = require("component")
event = require("event")
-- Get the lighting controller component
lc = component.openlightscontroller
-- Calibrate using Z and Y axes
-- Coordinate values increase as they move away from the controller toward border blocks
lc.calibrate("ZY")
w,h = lc.getSize()
-- Fill the entire light grid with yellow color at maximum brightness
lc.fillColor(0xffff00)
lc.fillBrightness(15)
-- Set black color for the light at position (1,1)
lc.setColor(0x000000,1,1)
-- Fill the area from (2,2) to (w,h) with red color
lc.fillColor(0xff0000,2,2,w,h)
-- Apply changes to the lights
lc.apply()
-- Wait for interrupt signal
event.pull('interrupt')
-- Fill the entire grid with black color
lc.fillColor(0x000000)
-- Apply changes
lc.apply()
LUA API
[x:number]
means these arguments are optional{x:number}
means that the arguments are repeatable, or the return value is an array
Method | Description |
---|---|
function apply():string; | Applies the saved lighting data to the lights. |
function isCalibrated():bool; | Checks if the lighting controller is calibrated. |
function calibrate(direction:string):string; | Performs calibration of the lighting controller. |
function getBorderAxes():string, string; | Returns the border axes coordinates. |
function getBorderDirections():string, string; | Returns the active border directions. |
function getSize():number, number; | Returns the dimensions of the light grid. |
function setColor(color:number, {x:number, y:number}):string; | Sets the light color in RGB format. Returns the new color as a hexadecimal string. Use tonumber(value, 16) to convert to a numeric value. The controller caches changes until apply() is called. |
function fillColor(color:number, [x1:number, y1:number, x2:number, y2:number]):string; | Fills a specific area or the entire grid with the specified RGB color. Returns the new color as a hexadecimal string. Use tonumber(value, 16) to convert to a numeric value. The controller caches changes until apply() is called. |
function setBrightness(brightness:number, {x:number, y:number}):number; | Sets the brightness of the light. Returns the new brightness value. The controller caches changes until apply() is called. |
function fillBrightness(brightness:number, [x1:number, y1:number, x2:number, y2:number]):number; | Fills a specific area or the entire grid with the specified brightness. Returns the new brightness value. The controller caches changes until apply() is called. |
function getColor({x:number, y:number}):{string}; | Returns the current light color as a hexadecimal string. Use tonumber(value, 16) to convert to a numeric value. Use getCachedColor() to get the cached color. |
function getBrightness({x:number, y:number}):{number}; | Returns the current brightness of the light. Use getCachedBrightness() to get the cached brightness. |
function getCachedColor({x:number, y:number}):{string}; | Returns the cached light color as a hexadecimal string. Use tonumber(value, 16) to convert to a numeric value. Use getColor() to get the current color. |
function getCachedBrightness({x:number, y:number}):{number}; | Returns the cached brightness of the light. Use getBrightness() to get the current brightness. |
function getMaximumBorderSize():number; | Returns the maximum border size. The value depends on the level of the lighting controller. |