Skip to main content

Drone

Struct Drone 

Source
pub struct Drone(pub Address);
Expand description

The drone component (33 methods).

Provided by OpenComputers’ Drone, DroneBase.

Tuple Fields§

§0: Address

Implementations§

Source§

impl Drone

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn get_acceleration(&self) -> Result<Number>

Get the currently set acceleration.

Lua: drone.getAcceleration():number Indirect call: waits for the next server tick.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn name(&self) -> Result<OcString>

Get the name of the agent.

Lua: drone.name():string Indirect call: waits for the next server tick.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn use_async( &self, side: impl Into<Number>, face: Option<Number>, sneaky: Option<bool>, duration: Option<Number>, ) -> Result<(bool, OcString)>

Self::use without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Trait Implementations§

Source§

impl Clone for Drone

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Component for Drone

Source§

const KIND: &'static str = "drone"

The OpenComputers component type, such as "gpu".
Source§

fn from_address(address: Address) -> Self

Wraps an address without checking what is there.
Source§

fn address(&self) -> &Address

Source§

fn first() -> Option<Self>

The first component of this type, by address order.
Source§

fn all() -> Vec<Self>

Every component of this type, by address order.
Source§

fn at(address: impl Into<Address>) -> Option<Self>

The component at address, if it is of this type.
Source§

fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>>

An untyped call, for methods the wrapper doesn’t know.
Source§

fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ

Component::invoke without blocking; see invoke_async.
Source§

impl Debug for Drone

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Drone

Source§

impl Hash for Drone

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Drone

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Drone

Auto Trait Implementations§

§

impl Forget for Drone

§

impl Freeze for Drone

§

impl Move for Drone

§

impl RefUnwindSafe for Drone

§

impl Send for Drone

§

impl Sync for Drone

§

impl Unpin for Drone

§

impl UnsafeUnpin for Drone

§

impl UnwindSafe for Drone

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.