Trait SharedCreepProperties

Source
pub trait SharedCreepProperties {
Show 15 methods // Required methods fn memory(&self) -> JsValue; fn set_memory(&self, val: &JsValue); fn my(&self) -> bool; fn name(&self) -> String; fn name_jsstring(&self) -> JsString; fn owner(&self) -> Owner; fn saying(&self) -> Option<JsString>; fn ticks_to_live(&self) -> Option<u32>; fn drop( &self, ty: ResourceType, amount: Option<u32>, ) -> Result<(), DropErrorCode>; fn notify_when_attacked( &self, enabled: bool, ) -> Result<(), NotifyWhenAttackedErrorCode>; fn pickup(&self, target: &Resource) -> Result<(), PickupErrorCode>; fn say(&self, message: &str, public: bool) -> Result<(), SayErrorCode>; fn suicide(&self) -> Result<(), SuicideErrorCode>; fn transfer<T>( &self, target: &T, ty: ResourceType, amount: Option<u32>, ) -> Result<(), TransferErrorCode> where T: Transferable + ?Sized; fn withdraw<T>( &self, target: &T, ty: ResourceType, amount: Option<u32>, ) -> Result<(), WithdrawErrorCode> 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 a String.

Screeps documentation

Source

fn name_jsstring(&self) -> JsString

The creep’s name as a JsString.

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 drop( &self, ty: ResourceType, amount: Option<u32>, ) -> Result<(), DropErrorCode>

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

Source

fn notify_when_attacked( &self, enabled: bool, ) -> Result<(), NotifyWhenAttackedErrorCode>

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

Source

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

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

Source

fn say(&self, message: &str, public: bool) -> Result<(), SayErrorCode>

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

Source

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

Immediately kill the creep.

Source

fn transfer<T>( &self, target: &T, ty: ResourceType, amount: Option<u32>, ) -> Result<(), TransferErrorCode>
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<(), WithdrawErrorCode>
where T: Withdrawable + ?Sized,

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

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.

Implementors§