LUA API - LemADEC/WarpDrive GitHub Wiki
Introduction
Most machines in the mod are provided 'as is' with a limited user interface. It's up to you to program and interconnect them to make the most of it. To this effect, an extensive API is provided for use in your ComputerCraft or OpenComputers LUA scripts.
Generalities
Basic programs are provided with most blocks, they're usually more up-to-date than this wiki, so you might want to start there. As a server/modpack owner, you may disable the default scripts and provide them through other means like a floppy, check the mod's configuration.
Warning: method and properties written in italic* are deprecated and subject to change.
Peripheral names
All machine names on the network are prefix with the mod name 'warpdrive'. Here's a non-exhaustive list of those names:
warpdriveAccelerator
warpdriveAcceleratorControlPoint
warpdriveAirGenerator
warpdriveCamera
warpdriveChunkloader (not documented yet)
warpdriveCloakingCore
warpdriveEnanReactorCore
warpdriveEnanReactorLaser
warpdriveEnergyBank
warpdriveForceFieldProjector
warpdriveForceFieldRelay
warpdriveLaser (not documented yet)
warpdriveLaserCamera
warpdriveLaserTreeFarm
warpdriveLift
warpdriveMiningLaser
warpdriveMonitor
warpdriveLaserMedium
warpdriveParticlesInjector
warpdriveRadar
warpdriveShipController (not documented yet)
warpdriveShipCore
warpdriveShipScanner
warpdriveTransporterBeacon
warpdriveTransporterCore
warpdriveWeaponController (no API)
Functional methods
The following table gives you which method is available for each block. You may refer to the LUA methods page for details.
Functional methods | Description | Machines |
---|---|---|
energy | Return the current and max energy | All energy blocks |
state | Return the current state of the machine | Mining laser, Laser tree farm, Scanner |
start | Start a new operation | Mining laser, Laser tree farm |
stop | Stop the current operation | Mining laser, Laser tree farm |
laserMediumDirection | Returns medium direction | Mining laser, Laser tree farm |
laserMediumCount | Returns number of medium connected | Mining laser, Laser tree farm |
isAssemblyValid* | Return whether cloaking multiblock is valid | Cloaking device |
getResultsCount | Return the number of results | Radar |
getResult | Return one of the result | Radar |
energy | Returns energy, max energy, energy rate | Enantiomorphic reactor core |
instability | Returns the 4 instability values (100 is the point when the reactor explodes) | Enantiomorphic reactor core |
release | Sets the reactor to output all energy or disables outputting of energy | Enantiomorphic reactor core |
releaseRate | Releases at most that much energy per tick | Enantiomorphic reactor core |
releaseAbove | Releases any energy above arg0 amount | Enantiomorphic reactor core |
hasReactor | Returns true if the laser can see a reactor and false otherwise | Enantiomorphic reactor laser |
side | Returns 0-3 depending on which side of the reactor its on | Enantiomorphic reactor laser |
sendLaser | Sends a laser of that much energy to stabilize the reactor | Enantiomorphic reactor laser |
scan* | Create a schematic from a ship | Scanner |
fileName* | Return the schematic filename | Scanner |
deploy* | Build a ship from a schematic | Scanner |
Get/set methods (pseudo-properties)
The following table gives you which property get/set methods are available for each block. You may refer to the LUA properties page for details.
Get/set method | Type | Default value | Range | Machines |
---|---|---|---|---|
enable | boolean | false | - | Cloaking core |
offset | Number | 1 | 1 to 255 | Mining laser |
radius | Number x Number | 8 x 8 | 3 to 16 | Laser tree farm |
tapTrees | boolean | false | - | Laser tree farm |
breakLeaves | boolean | false | - | Laser tree farm |
silktouch | boolean | false | - | Laser tree farm |
tier | Number | 1 | 1 or 2 | Cloaking core |
videoChannel | Number | -1 | ±INF | Camera, Monitor |
mode | String | redstone | up, down, redstone | Lift |
active | boolean | true | Enable/disable the machine | Enantiomorphic reactor core |