pub enum MovableObject {
    Creep(Creep),
    PowerCreep(PowerCreep),
}

Variants§

§

Creep(Creep)

§

PowerCreep(PowerCreep)

Trait Implementations§

source§

impl From<Creep> for MovableObject

source§

fn from(v: Creep) -> MovableObject

Converts to this type from the input type.
source§

impl From<PowerCreep> for MovableObject

source§

fn from(v: PowerCreep) -> MovableObject

Converts to this type from the input type.
source§

impl SharedCreepProperties for MovableObject

source§

fn memory(&self) -> JsValue

A shortcut to the part of the Memory tree used for this creep by default

source§

fn set_memory(&self, __enum_dispatch_arg_0: &JsValue)

Sets a new value to the memory object shortcut for this creep.

source§

fn my(&self) -> bool

Whether this creep is owned by the player.

source§

fn name(&self) -> String

The creep’s name as an owned reference to a String.

Screeps documentation

source§

fn owner(&self) -> Owner

The Owner of this creep that contains the owner’s username.

source§

fn saying(&self) -> Option<JsString>

What the creep said last tick.

source§

fn ticks_to_live(&self) -> Option<u32>

The number of ticks the creep has left to live.

source§

fn cancel_order( &self, __enum_dispatch_arg_0: &JsString ) -> Result<(), ErrorCode>

Cancel an a successfully called creep function from earlier in the tick, with a JsString that must contain the JS version of the function name.

source§

fn drop( &self, __enum_dispatch_arg_0: ResourceType, __enum_dispatch_arg_1: Option<u32> ) -> Result<(), ErrorCode>

Drop a resource on the ground from the creep’s Store.

source§

fn move_direction( &self, __enum_dispatch_arg_0: Direction ) -> Result<(), ErrorCode>

Move one square in the specified direction.

source§

fn move_by_path(&self, __enum_dispatch_arg_0: &JsValue) -> Result<(), ErrorCode>

Move the creep along a previously determined path returned from a pathfinding function, in array or serialized string form.

source§

fn move_to<T>(&self, __enum_dispatch_arg_0: T) -> Result<(), ErrorCode>
where T: HasPosition,

Move the creep toward the specified goal, either a RoomPosition or RoomObject. Note that using this function will store data in Memory.creeps[creep_name] and enable the default serialization behavior of the Memory object, which may hamper attempts to directly use RawMemory.

source§

fn move_to_with_options<T, F>( &self, __enum_dispatch_arg_0: T, __enum_dispatch_arg_1: Option<MoveToOptions<F>> ) -> Result<(), ErrorCode>

Move the creep toward the specified goal, either a RoomPosition or RoomObject. Note that using this function will store data in Memory.creeps[creep_name] and enable the default serialization behavior of the Memory object, which may hamper attempts to directly use RawMemory.

source§

fn notify_when_attacked( &self, __enum_dispatch_arg_0: bool ) -> Result<(), ErrorCode>

Whether to send an email notification when this creep is attacked.

source§

fn pickup(&self, __enum_dispatch_arg_0: &Resource) -> Result<(), ErrorCode>

Pick up a Resource in melee range (or at the same position as the creep).

source§

fn say( &self, __enum_dispatch_arg_0: &str, __enum_dispatch_arg_1: bool ) -> Result<(), ErrorCode>

Display a string in a bubble above the creep next tick. 10 character limit.

source§

fn suicide(&self) -> Result<(), ErrorCode>

Immediately kill the creep.

source§

fn transfer<T>( &self, __enum_dispatch_arg_0: &T, __enum_dispatch_arg_1: ResourceType, __enum_dispatch_arg_2: Option<u32> ) -> Result<(), ErrorCode>
where T: Transferable + ?Sized,

Transfer a resource from the creep’s store to Structure, PowerCreep, or another Creep.

source§

fn withdraw<T>( &self, __enum_dispatch_arg_0: &T, __enum_dispatch_arg_1: ResourceType, __enum_dispatch_arg_2: Option<u32> ) -> Result<(), ErrorCode>
where T: Withdrawable + ?Sized,

Withdraw a resource from a Structure, Tombstone, or Ruin.

source§

impl TryInto<Creep> for MovableObject

§

type Error = &'static str

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

fn try_into(self) -> Result<Creep, <Self as TryInto<Creep>>::Error>

Performs the conversion.
source§

impl TryInto<PowerCreep> for MovableObject

§

type Error = &'static str

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

fn try_into(self) -> Result<PowerCreep, <Self as TryInto<PowerCreep>>::Error>

Performs the conversion.

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>,

§

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>,

§

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.