This component is provided by the Robot. The functions below can be called in the Lua interpreter using =component.robot.function()
. To make robot function calls more intuitive, a Robot API exists as a wrapper around the component functions, providing additional functionality (which is summarized in the API page).
Component name: robot
.
durability():number
move(direction:number):boolean
turn(clockwise:boolean):boolean
name():string
swing(side:number):boolean[, string]
true
if successful (may take time depending on block being interacted with - e.g.. Obsidian takes time to mine). Returns false
if the operation fails with a description of why it failed.use(side: number[, sneaky: boolean[, duration: number]]): boolean[, string]
true
the robot will simulate a sneak-right-click (like if the player would be using shift during a right-click). Some items (like buckets) will behave differently if this is set to true.block_activated
- a block was activated (like levers, switches or doors).item_interacted
- the equipped tool interacted with the world, for example sheers when used on a sheep.item_placed
- something was placed into the world. This is not only caused by placeable blocks, but as well by items that cause blocks or entities to appear in the world (like flint and stone or mob eggs).item_used
- the equipped was activated, like a splash-potion.air
- the equipped item requires a target but there was none. Note that if your robot has an Angel upgrade, this will never be returned, however some actions might still cause no effect.place(side: number[, sneaky: boolean]): boolean[, string]
true
, the robot will simulate a sneak-placement (shift-click). Returns true
if successfully placed. Returns false
if the operation fails. If an unsupported value is provided as a parameter, the operation will fail with a description of why it failed. getLightColor():number
setLightColor(value:number):number
inventorySize():number
select([slot:number]):number
count([slot:number]):number
space([slot:number]):number
compareTo(otherSlot:number):boolean
transferTo(toSlot:number[, amount:number]):boolean
tankCount():number
selectTank(tank:number)
tankLevel([tank:number]):number
selectTank()
).tankSpace([tank:number]):number
compareFluidTo(tank:number):boolean
transferFluidTo(tank:number[, count:number]):boolean
detect(side:number):boolean
true
if the block will prevent the robot from moving forward, false
otherwise. Drones return true
even if the block is passable.
side - See the Sides API for a list of possible sides.
compareFluid(side:number):boolean
Compares fluid in the selected tank (requires a Tank upgrade) to fluid in the world or in an external tank on the specified side of the robot. drain(side:number[, count:number]):boolean
fill(side:number[, count:number]):boolean
compare(side:number[, fuzzy:boolean=false]):boolean
Compares the block on the specified side of the robot with the item in the currently selected slot and returns whether they are the same or not. Blocks are considered identical if the type and metadata match; additional ItemStack information is not checked. Empty blocks are considered as air blocks, which cannot be compared to an empty inventory slot; the detect()
function can be used to determine if there is a block in front of the robot. For blocks that drop a different item, the compare()
method won't work (eg: Diamond block dropping diamond items); for these cases, use silk-touch to obtain a block for comparison. drop(side:number[, count:number]):boolean
true
if at least one item is dropped, false
otherwise. If the block in front of the robot is an inventory, the robot will try to place the item into the inventory. If the inventory doesn't accept the item, the item is not dropped into the world (the operation will fail and return false
). Robots themselves are considered blocks with an inventory, and items can be moved into them using the drop()
function. The drop()
function will not work on non-item inventories, such as fluid tanks (the use()
function works for these cases). suck(side:number[, count:number]):boolean
Components | 3D Printer - Abstract Bus - Access Point - Chunkloader - Computer - Crafting - Data Card - Database - Debug - Drone - Drive - EEPROM - Experience - Filesystem - Generator - Geolyzer - GPU - Hologram - Internet - Inventory Controller - Leash - Microcontroller - Modem - Motion Sensor - Navigation - Net Splitter - Piston - Redstone - Redstone in Motion - Robot - Screen - Sign - Tank Controller - Tractor Beam - Transposer - Tunnel - World Sensor | |
---|---|---|
Others | Component Access - Signals | |
Cross-Mod Integration | Applied Energistics |