pub struct Drone(pub Address);Expand description
The drone component (33 methods).
Provided by OpenComputers’ Drone, DroneBase.
Tuple Fields§
§0: AddressImplementations§
Source§impl Drone
impl Drone
Sourcepub fn compare(
&self,
side: impl Into<Number>,
fuzzy: Option<bool>,
) -> Result<bool>
pub fn compare( &self, side: impl Into<Number>, fuzzy: Option<bool>, ) -> Result<bool>
Compare the block on the specified side with the one in the selected slot. Returns true if equal.
Lua: drone.compare(side:number[, fuzzy:boolean=false]):boolean
Indirect call: waits for the next server tick.
fuzzy defaults to false.
Sourcepub async fn compare_async(
&self,
side: impl Into<Number>,
fuzzy: Option<bool>,
) -> Result<bool>
pub async fn compare_async( &self, side: impl Into<Number>, fuzzy: Option<bool>, ) -> Result<bool>
Self::compare without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn compare_fluid(
&self,
side: impl Into<Number>,
tank: Option<Number>,
) -> Result<bool>
pub fn compare_fluid( &self, side: impl Into<Number>, tank: Option<Number>, ) -> Result<bool>
Compare the fluid in the selected tank with the fluid in the specified tank on the specified side. Returns true if equal.
Lua: drone.compareFluid(side:number [, tank:number]):boolean
Indirect call: waits for the next server tick.
Sourcepub async fn compare_fluid_async(
&self,
side: impl Into<Number>,
tank: Option<Number>,
) -> Result<bool>
pub async fn compare_fluid_async( &self, side: impl Into<Number>, tank: Option<Number>, ) -> Result<bool>
Self::compare_fluid without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn compare_fluid_to(&self, index: impl Into<Number>) -> Result<bool>
pub fn compare_fluid_to(&self, index: impl Into<Number>) -> Result<bool>
Compares the fluids in the selected and the specified tank. Returns true if equal.
Lua: drone.compareFluidTo(index:number):boolean
Indirect call: waits for the next server tick.
Sourcepub async fn compare_fluid_to_async(
&self,
index: impl Into<Number>,
) -> Result<bool>
pub async fn compare_fluid_to_async( &self, index: impl Into<Number>, ) -> Result<bool>
Self::compare_fluid_to without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn compare_to(
&self,
other_slot: impl Into<Number>,
check_nbt: Option<bool>,
) -> Result<bool>
pub fn compare_to( &self, other_slot: impl Into<Number>, check_nbt: Option<bool>, ) -> Result<bool>
Compare the contents of the selected slot to the contents of the specified slot.
Lua: drone.compareTo(otherSlot:number[, checkNBT:boolean=false]):boolean
Indirect call: waits for the next server tick.
check_nbt defaults to false.
Sourcepub async fn compare_to_async(
&self,
other_slot: impl Into<Number>,
check_nbt: Option<bool>,
) -> Result<bool>
pub async fn compare_to_async( &self, other_slot: impl Into<Number>, check_nbt: Option<bool>, ) -> Result<bool>
Self::compare_to without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn count(&self, slot: Option<Number>) -> Result<Number>
pub fn count(&self, slot: Option<Number>) -> Result<Number>
Get the number of items in the specified slot, otherwise in the selected slot.
Lua: drone.count([slot:number]):number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn count_async(&self, slot: Option<Number>) -> Result<Number>
pub async fn count_async(&self, slot: Option<Number>) -> Result<Number>
Self::count without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn detect(&self, side: impl Into<Number>) -> Result<(bool, OcString)>
pub fn detect(&self, side: impl Into<Number>) -> Result<(bool, OcString)>
Checks the contents of the block on the specified sides and returns the findings.
Lua: drone.detect(side:number):boolean, string
Indirect call: waits for the next server tick.
Sourcepub async fn detect_async(
&self,
side: impl Into<Number>,
) -> Result<(bool, OcString)>
pub async fn detect_async( &self, side: impl Into<Number>, ) -> Result<(bool, OcString)>
Self::detect without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn drain(
&self,
side: impl Into<Number>,
amount: Option<Number>,
) -> Result<(bool, Value)>
pub fn drain( &self, side: impl Into<Number>, amount: Option<Number>, ) -> Result<(bool, Value)>
Drains the specified amount of fluid from the specified side. Returns the amount drained, or an error message.
Lua: drone.drain(side:number[, amount:number=1000]):boolean, number or string
Indirect call: waits for the next server tick.
amount defaults to 1000.
Sourcepub async fn drain_async(
&self,
side: impl Into<Number>,
amount: Option<Number>,
) -> Result<(bool, Value)>
pub async fn drain_async( &self, side: impl Into<Number>, amount: Option<Number>, ) -> Result<(bool, Value)>
Self::drain without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn drop(
&self,
side: impl Into<Number>,
count: Option<Number>,
) -> Result<bool>
pub fn drop( &self, side: impl Into<Number>, count: Option<Number>, ) -> Result<bool>
Drops items from the selected slot towards the specified side.
Lua: drone.drop(side:number[, count:number=64]):boolean
Indirect call: waits for the next server tick.
count defaults to 64.
Sourcepub async fn drop_async(
&self,
side: impl Into<Number>,
count: Option<Number>,
) -> Result<bool>
pub async fn drop_async( &self, side: impl Into<Number>, count: Option<Number>, ) -> Result<bool>
Self::drop without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn fill(
&self,
side: impl Into<Number>,
amount: Option<Number>,
) -> Result<(bool, Value)>
pub fn fill( &self, side: impl Into<Number>, amount: Option<Number>, ) -> Result<(bool, Value)>
Eject the specified amount of fluid to the specified side. Returns the amount ejected or an error message.
Lua: drone.fill(side:number[, amount:number=1000]):boolean, number or string
Indirect call: waits for the next server tick.
amount defaults to 1000.
Sourcepub async fn fill_async(
&self,
side: impl Into<Number>,
amount: Option<Number>,
) -> Result<(bool, Value)>
pub async fn fill_async( &self, side: impl Into<Number>, amount: Option<Number>, ) -> Result<(bool, Value)>
Self::fill without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_acceleration(&self) -> Result<Number>
pub fn get_acceleration(&self) -> Result<Number>
Get the currently set acceleration.
Lua: drone.getAcceleration():number
Indirect call: waits for the next server tick.
Sourcepub async fn get_acceleration_async(&self) -> Result<Number>
pub async fn get_acceleration_async(&self) -> Result<Number>
Self::get_acceleration without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_light_color(&self) -> Result<Number>
pub fn get_light_color(&self) -> Result<Number>
Get the current color of the flap lights as an integer encoded RGB value (0xRRGGBB).
Lua: drone.getLightColor():number
Indirect call: waits for the next server tick.
Sourcepub async fn get_light_color_async(&self) -> Result<Number>
pub async fn get_light_color_async(&self) -> Result<Number>
Self::get_light_color without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_max_velocity(&self) -> Result<Number>
pub fn get_max_velocity(&self) -> Result<Number>
Get the maximum velocity, in m/s.
Lua: drone.getMaxVelocity():number
Indirect call: waits for the next server tick.
Sourcepub async fn get_max_velocity_async(&self) -> Result<Number>
pub async fn get_max_velocity_async(&self) -> Result<Number>
Self::get_max_velocity without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_offset(&self) -> Result<Number>
pub fn get_offset(&self) -> Result<Number>
Get the current distance to the target position.
Lua: drone.getOffset():number
Indirect call: waits for the next server tick.
Sourcepub async fn get_offset_async(&self) -> Result<Number>
pub async fn get_offset_async(&self) -> Result<Number>
Self::get_offset without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_status_text(&self) -> Result<OcString>
pub fn get_status_text(&self) -> Result<OcString>
Get the status text currently being displayed in the GUI.
Lua: drone.getStatusText():string
Indirect call: waits for the next server tick.
Sourcepub async fn get_status_text_async(&self) -> Result<OcString>
pub async fn get_status_text_async(&self) -> Result<OcString>
Self::get_status_text without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_velocity(&self) -> Result<Number>
pub fn get_velocity(&self) -> Result<Number>
Get the current velocity in m/s.
Lua: drone.getVelocity():number
Indirect call: waits for the next server tick.
Sourcepub async fn get_velocity_async(&self) -> Result<Number>
pub async fn get_velocity_async(&self) -> Result<Number>
Self::get_velocity without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn inventory_size(&self) -> Result<Number>
pub fn inventory_size(&self) -> Result<Number>
The size of this device’s internal inventory.
Lua: drone.inventorySize():number
Indirect call: waits for the next server tick.
Sourcepub async fn inventory_size_async(&self) -> Result<Number>
pub async fn inventory_size_async(&self) -> Result<Number>
Self::inventory_size without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn move(
&self,
dx: impl Into<Number>,
dy: impl Into<Number>,
dz: impl Into<Number>,
) -> Result<()>
pub fn move( &self, dx: impl Into<Number>, dy: impl Into<Number>, dz: impl Into<Number>, ) -> Result<()>
Change the target position by the specified offset.
Lua: drone.move(dx:number, dy:number, dz:number)
Indirect call: waits for the next server tick.
Sourcepub async fn move_async(
&self,
dx: impl Into<Number>,
dy: impl Into<Number>,
dz: impl Into<Number>,
) -> Result<()>
pub async fn move_async( &self, dx: impl Into<Number>, dy: impl Into<Number>, dz: impl Into<Number>, ) -> Result<()>
Self::move without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn name(&self) -> Result<OcString>
pub fn name(&self) -> Result<OcString>
Get the name of the agent.
Lua: drone.name():string
Indirect call: waits for the next server tick.
Sourcepub async fn name_async(&self) -> Result<OcString>
pub async fn name_async(&self) -> Result<OcString>
Self::name without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn place(
&self,
side: impl Into<Number>,
face: Option<Number>,
sneaky: Option<bool>,
) -> Result<bool>
pub fn place( &self, side: impl Into<Number>, face: Option<Number>, sneaky: Option<bool>, ) -> Result<bool>
Place a block towards the specified side. The `face’ allows a more precise click calibration, and is relative to the targeted blockspace.
Lua: drone.place(side:number[, face:number=side[, sneaky:boolean=false]]):boolean
Indirect call: waits for the next server tick.
face defaults to side.
sneaky defaults to false.
Sourcepub async fn place_async(
&self,
side: impl Into<Number>,
face: Option<Number>,
sneaky: Option<bool>,
) -> Result<bool>
pub async fn place_async( &self, side: impl Into<Number>, face: Option<Number>, sneaky: Option<bool>, ) -> Result<bool>
Self::place without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn select(&self, slot: Option<Number>) -> Result<Number>
pub fn select(&self, slot: Option<Number>) -> Result<Number>
Get the currently selected slot; set the selected slot if specified.
Lua: drone.select([slot:number]):number
Indirect call: waits for the next server tick.
Sourcepub async fn select_async(&self, slot: Option<Number>) -> Result<Number>
pub async fn select_async(&self, slot: Option<Number>) -> Result<Number>
Self::select without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn select_tank(&self, index: Option<Number>) -> Result<Number>
pub fn select_tank(&self, index: Option<Number>) -> Result<Number>
Select a tank and/or get the number of the currently selected tank.
Lua: drone.selectTank([index:number]):number
Indirect call: waits for the next server tick.
Sourcepub async fn select_tank_async(&self, index: Option<Number>) -> Result<Number>
pub async fn select_tank_async(&self, index: Option<Number>) -> Result<Number>
Self::select_tank without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set_acceleration(&self, value: impl Into<Number>) -> Result<Number>
pub fn set_acceleration(&self, value: impl Into<Number>) -> Result<Number>
Try to set the acceleration.
Lua: drone.setAcceleration(value:number):number
Indirect call: waits for the next server tick.
Sourcepub async fn set_acceleration_async(
&self,
value: impl Into<Number>,
) -> Result<Number>
pub async fn set_acceleration_async( &self, value: impl Into<Number>, ) -> Result<Number>
Self::set_acceleration without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set_light_color(&self, value: impl Into<Number>) -> Result<Number>
pub fn set_light_color(&self, value: impl Into<Number>) -> Result<Number>
Set the color of the flap lights to the specified integer encoded RGB value (0xRRGGBB).
Lua: drone.setLightColor(value:number):number
Indirect call: waits for the next server tick.
Sourcepub async fn set_light_color_async(
&self,
value: impl Into<Number>,
) -> Result<Number>
pub async fn set_light_color_async( &self, value: impl Into<Number>, ) -> Result<Number>
Self::set_light_color without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set_status_text(&self, value: impl AsRef<[u8]>) -> Result<OcString>
pub fn set_status_text(&self, value: impl AsRef<[u8]>) -> Result<OcString>
Set the status text to display in the GUI, returns new value.
Lua: drone.setStatusText(value:string):string
Indirect call: waits for the next server tick.
Sourcepub async fn set_status_text_async(
&self,
value: impl AsRef<[u8]>,
) -> Result<OcString>
pub async fn set_status_text_async( &self, value: impl AsRef<[u8]>, ) -> Result<OcString>
Self::set_status_text without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn space(&self, slot: Option<Number>) -> Result<Number>
pub fn space(&self, slot: Option<Number>) -> Result<Number>
Get the remaining space in the specified slot, otherwise in the selected slot.
Lua: drone.space([slot:number]):number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn space_async(&self, slot: Option<Number>) -> Result<Number>
pub async fn space_async(&self, slot: Option<Number>) -> Result<Number>
Self::space without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn suck(
&self,
side: impl Into<Number>,
count: Option<Number>,
) -> Result<bool>
pub fn suck( &self, side: impl Into<Number>, count: Option<Number>, ) -> Result<bool>
Suck up items from the specified side.
Lua: drone.suck(side:number[, count:number=64]):boolean
Indirect call: waits for the next server tick.
count defaults to 64.
Sourcepub async fn suck_async(
&self,
side: impl Into<Number>,
count: Option<Number>,
) -> Result<bool>
pub async fn suck_async( &self, side: impl Into<Number>, count: Option<Number>, ) -> Result<bool>
Self::suck without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn swing(
&self,
side: impl Into<Number>,
face: Option<Number>,
sneaky: Option<bool>,
) -> Result<(bool, OcString)>
pub fn swing( &self, side: impl Into<Number>, face: Option<Number>, sneaky: Option<bool>, ) -> Result<(bool, OcString)>
Perform a ‘left click’ towards the specified side. The `face’ allows a more precise click calibration, and is relative to the targeted blockspace.
Lua: drone.swing(side:number[, face:number=side[, sneaky:boolean=false]]):boolean, string
Indirect call: waits for the next server tick.
face defaults to side.
sneaky defaults to false.
Sourcepub async fn swing_async(
&self,
side: impl Into<Number>,
face: Option<Number>,
sneaky: Option<bool>,
) -> Result<(bool, OcString)>
pub async fn swing_async( &self, side: impl Into<Number>, face: Option<Number>, sneaky: Option<bool>, ) -> Result<(bool, OcString)>
Self::swing without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn tank_count(&self) -> Result<Number>
pub fn tank_count(&self) -> Result<Number>
The number of tanks installed in the device.
Lua: drone.tankCount():number
Indirect call: waits for the next server tick.
Sourcepub async fn tank_count_async(&self) -> Result<Number>
pub async fn tank_count_async(&self) -> Result<Number>
Self::tank_count without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn tank_level(&self, index: Option<Number>) -> Result<Number>
pub fn tank_level(&self, index: Option<Number>) -> Result<Number>
Get the fluid amount in the specified or selected tank.
Lua: drone.tankLevel([index:number]):number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn tank_level_async(&self, index: Option<Number>) -> Result<Number>
pub async fn tank_level_async(&self, index: Option<Number>) -> Result<Number>
Self::tank_level without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn tank_space(&self, index: Option<Number>) -> Result<Number>
pub fn tank_space(&self, index: Option<Number>) -> Result<Number>
Get the remaining fluid capacity in the specified or selected tank.
Lua: drone.tankSpace([index:number]):number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn tank_space_async(&self, index: Option<Number>) -> Result<Number>
pub async fn tank_space_async(&self, index: Option<Number>) -> Result<Number>
Self::tank_space without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn transfer_fluid_to(
&self,
index: impl Into<Number>,
count: Option<Number>,
) -> Result<bool>
pub fn transfer_fluid_to( &self, index: impl Into<Number>, count: Option<Number>, ) -> Result<bool>
Move the specified amount of fluid from the selected tank into the specified tank.
Lua: drone.transferFluidTo(index:number[, count:number=1000]):boolean
Indirect call: waits for the next server tick.
count defaults to 1000.
Sourcepub async fn transfer_fluid_to_async(
&self,
index: impl Into<Number>,
count: Option<Number>,
) -> Result<bool>
pub async fn transfer_fluid_to_async( &self, index: impl Into<Number>, count: Option<Number>, ) -> Result<bool>
Self::transfer_fluid_to without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn transfer_to(
&self,
to_slot: impl Into<Number>,
amount: Option<Number>,
) -> Result<bool>
pub fn transfer_to( &self, to_slot: impl Into<Number>, amount: Option<Number>, ) -> Result<bool>
Move up to the specified amount of items from the selected slot into the specified slot.
Lua: drone.transferTo(toSlot:number[, amount:number]):boolean
Indirect call: waits for the next server tick.
Sourcepub async fn transfer_to_async(
&self,
to_slot: impl Into<Number>,
amount: Option<Number>,
) -> Result<bool>
pub async fn transfer_to_async( &self, to_slot: impl Into<Number>, amount: Option<Number>, ) -> Result<bool>
Self::transfer_to without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn use(
&self,
side: impl Into<Number>,
face: Option<Number>,
sneaky: Option<bool>,
duration: Option<Number>,
) -> Result<(bool, OcString)>
pub fn use( &self, side: impl Into<Number>, face: Option<Number>, sneaky: Option<bool>, duration: Option<Number>, ) -> Result<(bool, OcString)>
Perform a ‘right click’ towards the specified side. The `face’ allows a more precise click calibration, and is relative to the targeted blockspace.
Lua: drone.use(side:number[, face:number=side[, sneaky:boolean=false[, duration:number=0]]]):boolean, string
Indirect call: waits for the next server tick.
face defaults to side.
sneaky defaults to false.
duration defaults to 0.
Trait Implementations§
Source§impl Component for Drone
impl Component for Drone
Source§fn from_address(address: Address) -> Self
fn from_address(address: Address) -> Self
fn address(&self) -> &Address
Source§fn at(address: impl Into<Address>) -> Option<Self>
fn at(address: impl Into<Address>) -> Option<Self>
address, if it is of this type.Source§fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>>
fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>>
Source§fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ
fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ
Component::invoke without blocking; see invoke_async.