Skip to main content

Bot

Struct Bot 

Source
pub struct Bot { /* private fields */ }

Implementations§

Source§

impl Bot

Source

pub fn world(&self) -> &WorldMap

Read-only access to the world map.

Source

pub fn user_id(&self) -> Option<usize>

The bot’s player id, once received from the server.

Source

pub fn position(&self) -> Option<(usize, usize)>

The bot’s current position, once received from the server.

Source

pub fn safe_directions(&self) -> Vec<MoveDirection>

Returns every direction whose neighbouring cell is currently empty.

Source

pub fn is_blocked(&self, direction: MoveDirection) -> bool

True if moving in direction from the current position would hit a trail. Returns true when the position is unknown.

Source

pub fn write_packet(&mut self, packet: ClientPacket)

Write a raw packet to the server.

Source

pub fn chat(&mut self, message: impl Into<String>)

Send a message in chat, make sure to not get rate limited.

Source

pub fn do_move(&mut self, direction: MoveDirection)

Set a move direction. (I think you should only do one per tick I dir not test several)

Auto Trait Implementations§

§

impl Freeze for Bot

§

impl RefUnwindSafe for Bot

§

impl Send for Bot

§

impl Sync for Bot

§

impl Unpin for Bot

§

impl UnsafeUnpin for Bot

§

impl UnwindSafe for Bot

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.