Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
component:agent [2018/09/27 01:20]
payonel
component:agent [2018/09/27 01:58]
payonel
Line 52: Line 52:
   Tries to place the block in the currently selected inventory slot on the specified side of the robot (if the side is supported). If **sneaky** is set to `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. ​   Tries to place the block in the currently selected inventory slot on the specified side of the robot (if the side is supported). If **sneaky** is set to `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`  ​ - `getLightColor():​number`  ​
-  Get the current color of the activity light as an integer encoded RGB value (0xRRGGBB).+  Get the current color of the activity(robot) or flap(drone) ​light as an integer encoded RGB value (0xRRGGBB).
 - `setLightColor(value:​number):​number`  ​ - `setLightColor(value:​number):​number`  ​
-  Set the color of the activity light to the specified integer encoded RGB value (0xRRGGBB).+  Set the color of the activity(robot) or flap(drone) ​light to the specified integer encoded RGB value (0xRRGGBB).
  
 ====TankControl Trait API==== ====TankControl Trait API====
Line 70: Line 70:
 - `transferFluidTo(tank:​number[,​ count:​number]):​boolean`  ​ - `transferFluidTo(tank:​number[,​ count:​number]):​boolean`  ​
   Transfer the specified amount of fluid in the selected tank into the specified tank. If no volume is specified, the  robot will attempt to transfer 1000mB.   Transfer the specified amount of fluid in the selected tank into the specified tank. If no volume is specified, the  robot will attempt to transfer 1000mB.
 +
 +====InventoryWorldController trait API====
 +
 +- `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`  ​
 +  Drops the specified number of items from the currently selected slot. Returns `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`  ​
 +  Tries to pick up the specified number of items and place it in the selected slot. If the selected slot is occupied, items will be placed in the first available slot. 
  
 ====Robot Component API==== ====Robot Component API====
Line 80: Line 89:
   Rotate in the specified direction.   Rotate in the specified direction.
  
-====InventoryWorldController trait API====+====Drone Component ​API====
  
-- `compare(side:​number[,​ fuzzy:​boolean=false]):boolean+- `getStatusText():string  
-  ​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 notBlocks 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 itemthe `compare()` method won't work (eg: Diamond block dropping diamond items); for these cases, use silk-touch to obtain a block for comparison.  +  ​Get the status text currently being displayed ​in the GUI. 
-- `drop(side:number[count:number]):boolean`   +`setStatusText(value:​string):string  
-  ​Drops the specified ​number of items from the currently selected slotReturns ​`trueif 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 inventoryIf 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()` functionThe `drop()` function will not work on non-item inventories,​ such as fluid tanks (the `use()` function works for these cases).  +  Set the status text to display ​in the GUIreturns new value
-- `suck(side:number[, count:number]):boolean`   +- `move(dx:​number, ​dy:number, dz:number)`   
-  ​Tries to pick up the specified ​number of items and place it in the selected slot. If the selected slot is occupied, items will be placed in the first available slot+  ​Change the target position by the specified ​offset. 
 +`getOffset():​number  
 +  Get the current distance ​to the target position. 
 +`getVelocity():number  
 +  Get the current velocity in m/s. 
 +`getMaxVelocity():number  
 +  Get the maximum velocity, in m/s. 
 +- `getAcceleration():number  
 +  Get the currently set acceleration
 +- `setAcceleration(value:number):​number` ​  
 +  ​Try to set the acceleration ​to the specified ​value and return ​the new acceleration.