Controller
The program, that manages controlling the essentia valves and reading amount of aspects stored in jars
Contents:
Dependencies
Configurable Properties
Name |
Type |
Default |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
servedAspects
A list containing the names of all aspects this controller serves. The order of aspects determines the local ID for each aspect.
local servedAspects = {}
Type:
table
Default:
{}
Warning
Please make sure, that the order of the aspects matches the order of the color channels used in the bundled cable. To see the order of the colors, consult the table at the bottom of this page.
outputSide
The side the bundled cable is connected to the computer.
local outputSide = "back"
Type:
string
Default:
"back"
modemSide
The side the wireless modem is connected to the computer.
local modemSide = "top"
Type:
string
Default:
"top"
Requests
FLOW
Release 5 essentia from the specified aspect. Fails if aspect is not serverd by controller or amount of essentia of specified aspect is less than 5.
{head = "FLOW", contents = {aspect = ""}}
request Contents:
Name |
Type |
Default |
Description |
---|---|---|---|
aspect |
|
|
Aspect of which 5 essentia should be released. |
Response contents: nil
PROBE
Probe the amount of specified aspect in jar. Fails if aspect is not serverd by controller.
{head = "PROBE", contents = {aspect = ""}}
Request Contents:
Name |
Type |
Default |
Description |
---|---|---|---|
aspect |
|
|
Aspect of which the amount should be probed. |
Response contents:
Name |
Type |
Description |
---|---|---|
aspect |
|
Aspect in probed jar. |
amount |
|
Amount of stored essentia in probed jar. |
Warning
If aspect
in response contents doesn’t match with aspect
in request contents, then the order of nbtPeripheralTags is most likely faulty.
Constants
Name |
Type |
Value |
---|---|---|
|
|
|
|
|
title
The title of this program.
local title = "Essentia Controller"
Type:
string
Default:
"Essentia Controller"
version
The version of this program.
local version = "v1.0"
Type:
string
Default:
"v1.0"
Internal Properties
Name |
Type |
Default |
---|---|---|
|
|
|
|
|
nbtPeripherals
A list containing the wrapped nbt observer peripherals.
local nbtPeripherals = {}
Type:
table
Default:
{}
sModem
An instance of a secure modem object
local sModem = nil
Type:
sModem
Default:
nil
Local Functions
Note
Local functions are defined in a local scope and thus can only be used within this program. They mainly server as helper functions for the program itself.
getLocalID(aspect)
Converts aspect name to local ID using servedAspects.
local funtion getLocalID(aspect)
...
return localID
end
Arguments:
Name |
Type |
Default |
Description |
---|---|---|---|
aspect |
|
|
Aspect to convert to local ID. |
Returns:
Type |
Description |
---|---|
|
Local ID of aspect or 0 if aspect is not served. |
Example:
local servedAspects = {"terra", "aqua", "aer", "ignis", "ordo"}
local localID = getLocalID("aer")
In this case, localID
would equal to 3
, since aer
is the third element in the table
Note
The table servedAspects
would normally be set as a configurable property
sendPulse(id)
Sends a redstone pulse on the specified channel through the bundled wire at outputSide.
local funtion snedPulse(id)
...
end
Arguments:
Name |
Type |
Default |
Description |
---|---|---|---|
id |
|
|
Local ID of aspect / Channel to send a pulse to. |
Returns: nil
Example:
sendPulse(4)
This would send a redstone pulse on the outputSide on the color channel corresponding to the number 2 ^ (id - 1)
,
in this case 8
, which corresponds to the color lightBlue
as seen here. Thus this command would send a pulse on the lightBlue channel.