Skip to main content

BlockOperationsModule

Struct BlockOperationsModule 

Source
pub struct BlockOperationsModule(pub String);
Expand description

A device capable of manipulating blocks in the world

Tuple Fields§

§0: String

Trait Implementations§

Source§

impl BlockOperationsInterface for BlockOperationsModule

Source§

fn excavate(&self, bus: &mut DeviceBus, side: &str) -> Result<bool>

OC2 Docs: tries to break a block in the specified direction. Collected blocks will be inserted starting at the currently selected inventory slot. If the selected slot is full, the next slot will be used, and so on. If the inventory has no space for the dropped block, it will drop into the world. Returns whether the operation was successful.
Source§

fn place(&self, bus: &mut DeviceBus, side: &str) -> Result<bool>

OC2 Docs: tries to place a block in the specified direction. Blocks will be placed from the currently selected inventory slot. If the slot is empty, no block will be placed. Returns whether the operation was successful.
Source§

fn durability(&self, bus: &mut DeviceBus) -> Result<i32>

OC2 Docs: returns the remaining durability of the module’s excavation tool. Once the durability has reached zero, no further excavation operations can be performed until it is repaired.
Source§

fn repair(&self, bus: &mut DeviceBus) -> Result<bool>

OC2 Docs: attempts to repair the module’s excavation tool using materials in the currently selected inventory slot. This method will consume one item at a time. Any regular tool may act as the source for repair materials, such as pickaxes and shovels. The quality of the tool directly effects the amount of durability restored. Returns whether some material could be used to repair the module’s excavation tool.
Source§

impl IdentifiedDevice for BlockOperationsModule

Source§

const IDENTITY: &'static str = "block_operations"

Source§

impl RPCDevice for BlockOperationsModule

Source§

fn id(&self) -> &str

Returns uuid of this device.
Source§

fn from_id(id: String) -> Self

Create a device wrapper from an id.

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.