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

table

{}

nbtPeripheralTags

table

{}

outputSide

string

"back"

modemSide

string

"top"

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.


nbtPeripheralTags

A list containing the peripheral names (e.g. nbt_observer_0) for the NBT observers. The order of tags corresponds to the local ID.

local nbtPeripheralTags = {}
  • Type: table

  • Default: {}

Warning

Please make sure, that the order of the peripheral names and the order of aspects in servedAspects match.


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

string

nil

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

string

nil

Aspect of which the amount should be probed.

Response contents:

Name

Type

Description

aspect

string

Aspect in probed jar.

amount

number

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

string

"Essentia Controller"

version

string

"v1.0"

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

table

{}

sModem

sModem

nil

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

string

nil

Aspect to convert to local ID.

Returns:

Type

Description

number

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

number

nil

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.