pub trait SharedCreepProperties {
Show 19 methods // Required methods fn memory(&self) -> JsValue; fn set_memory(&self, val: &JsValue); fn my(&self) -> bool; fn name(&self) -> String; fn owner(&self) -> Owner; fn saying(&self) -> Option<JsString>; fn ticks_to_live(&self) -> Option<u32>; fn cancel_order(&self, target: &JsString) -> Result<(), ErrorCode>; fn drop( &self, ty: ResourceType, amount: Option<u32> ) -> Result<(), ErrorCode>; fn move_direction(&self, direction: Direction) -> Result<(), ErrorCode>; fn move_by_path(&self, path: &JsValue) -> Result<(), ErrorCode>; fn move_to<T>(&self, target: T) -> Result<(), ErrorCode> where T: HasPosition; fn move_to_with_options<T, F>( &self, target: T, options: Option<MoveToOptions<F>> ) -> Result<(), ErrorCode> where T: HasPosition, F: FnMut(RoomName, CostMatrix) -> SingleRoomCostResult; fn notify_when_attacked(&self, enabled: bool) -> Result<(), ErrorCode>; fn pickup(&self, target: &Resource) -> Result<(), ErrorCode>; fn say(&self, message: &str, public: bool) -> Result<(), ErrorCode>; fn suicide(&self) -> Result<(), ErrorCode>; fn transfer<T>( &self, target: &T, ty: ResourceType, amount: Option<u32> ) -> Result<(), ErrorCode> where T: Transferable + ?Sized; fn withdraw<T>( &self, target: &T, ty: ResourceType, amount: Option<u32> ) -> Result<(), ErrorCode> where T: Withdrawable + ?Sized;
}

Required Methods§

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, val: &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, target: &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, ty: ResourceType, amount: Option<u32>) -> Result<(), ErrorCode>

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

source

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

Move one square in the specified direction.

source

fn move_by_path(&self, path: &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, target: 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, target: T, options: 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, enabled: bool) -> Result<(), ErrorCode>

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

source

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

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

source

fn say(&self, message: &str, public: 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, target: &T, ty: ResourceType, amount: 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, target: &T, ty: ResourceType, amount: Option<u32> ) -> Result<(), ErrorCode>
where T: Withdrawable + ?Sized,

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

Object Safety§

This trait is not object safe.

Implementors§