pub trait BlockOperationsInterface: RPCDevice {
// Provided methods
fn excavate(&self, bus: &mut DeviceBus, side: &str) -> Result<bool> { ... }
fn place(&self, bus: &mut DeviceBus, side: &str) -> Result<bool> { ... }
fn durability(&self, bus: &mut DeviceBus) -> Result<i32> { ... }
fn repair(&self, bus: &mut DeviceBus) -> Result<bool> { ... }
}Expand description
An interface that allows for the manipulation of blocks in the world.
The side parameter in the following methods represents a direction from the perspective of the robot. Valid values are: “front”, “up” and “down”
Provided Methods§
Sourcefn excavate(&self, bus: &mut DeviceBus, side: &str) -> Result<bool>
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.
Sourcefn place(&self, bus: &mut DeviceBus, side: &str) -> Result<bool>
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.
Sourcefn durability(&self, bus: &mut DeviceBus) -> Result<i32>
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.
Sourcefn repair(&self, bus: &mut DeviceBus) -> Result<bool>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.