LUA methods - LemADEC/WarpDrive GitHub Wiki

Generic methods

interfaced()

Returns a mod specific message.

message = xxx.interfaced()
  • message is a mod specific string, mostly for mod debug purpose

position()

Returns ship blocks position in current dimension.

x, y, z = xxx.position()
  • x, y, z are the block coordinates in the current dimension

When used on a radar, you can also get the universal coordinates of the block.

x, y, z, celestialName, universalX, universalY, universalZ, galaxyName = xxx.position()
  • x, y, z are the block coordinates in the current dimension
  • celestialName is the name of the celestial object you're in, or the dimension name if you're 'outside charted space'.
  • universalX/Y/Z are the block coordinates in the current galaxy, or in the current dimension if you're 'outside charted space'.

version()

Returns the mod version numbers.

major, minor, build = xxx.version()
  • major, minor, build are the version numbers for the mod. For example 1.3.31 will return respectively 1, 3 and 31.

energy()

Returns the current energy state of this block. All values are returned in EU.

current, capacity, outputRate = xxx.energy()
  • current is the current energy quantity stored
  • capacity is the maximum storage capacity
  • outputRate is the average energy output per tick or nil (depending on the block)

start()

Starts the operation.

success, message = xxx.start()
  • message might be nil, depending on the machine

stop()

Stops the current operation.

xxx.stop()

state()

For a scanner:

isActive, stateKeyString, currentIndex, totalCount = scanner.state()
  • isActive is true when a scan or deployment is ongoing
  • stateKeyString is "IDLE", "Scanning" or "Deploying"
  • currentIndex and totalCount reports the progress on current deployment, 0 otherwise

For a mining laser:

statusString, isActive, energyLevel, currentLayer, mined, mineCount = miner.state()
  • statusString is a humanly readable status of the mining laser
  • isActive is true when scanning or mining is ongoing
  • mined and mineCount gives the progression on currentLayer Y level

For a laser tree farm:

statusString, isActive, energyLevel, totalHarvested, harvested, harvestCount = farm.state()
  • statusString is a humanly readable status of the machine
  • isActive is true when scanning or mining is ongoing
  • totalHarvested is the number of items collected
  • harvested and harvestCount gives the progression of current harvest (in blocks)

For a lift:

statusString, isActive, energyLevel, isValid, isEnabled, mode = lift.state()
  • statusString is a humanly readable status of the machine
  • isActive is true when lift is ready to transfer entities
  • isValid is true when enough space is available above and below the lift
  • isEnabled is true when the lift operation is authorized
  • mode is the current computer control mode

For a Enantiomorphic reactor:

statusString, isActive, energyContained, releaseMode, releaseThreshold = reactor.state()
  • statusString is a humanly readable status of the machine
  • isActive is true when reactor is producing energy
  • releaseMode and releaseThreshold are the current energy output configuration of the reactor

Scanner specific methods

scan()

Starts scanning a ship. You need to perfectly align its Ship core with the scanner first.

success, index, message = xxx.scan()
  • success is a boolean, true means the scan as started, false invites you to check the message
  • index is an number, 0 for already scanning, 1 for missing ship core, 2 for not enough power, 3 for success

fileName()

Returns the schematic filename for later usage with the deploy() method.
Schematics are saved on the server. Exact location is defined in the mod's configuration file.

success, filename = xxx.fileName()
  • success is a boolean, false means the filename is actually an error message you want to read

deploy()

Start building a ship from the provided schematic at the given coordinates.

index, message = xxx.deploy(fileName, offsetX, offsetY, offsetZ, rotation)
  • fileName is the schematic to use, as provided during the initial scan
  • offsetX/Y/Z is the relative coordinate of the new ship core relative to the scanner block
  • rotation is the number 90 deg steps of rotation to the right (0 = no rotation, 1 = rotate 90 deg right, etc.)