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§
Sourcefn memory(&self) -> JsValue
fn memory(&self) -> JsValue
A shortcut to the part of the Memory tree used for this creep by
default
Sourcefn set_memory(&self, val: &JsValue)
fn set_memory(&self, val: &JsValue)
Sets a new value to the memory object shortcut for this creep.
Sourcefn name_jsstring(&self) -> JsString
fn name_jsstring(&self) -> JsString
The creep’s name as a JsString.
Sourcefn ticks_to_live(&self) -> Option<u32>
fn ticks_to_live(&self) -> Option<u32>
The number of ticks the creep has left to live.
Sourcefn drop(
&self,
ty: ResourceType,
amount: Option<u32>,
) -> Result<(), DropErrorCode>
fn drop( &self, ty: ResourceType, amount: Option<u32>, ) -> Result<(), DropErrorCode>
Drop a resource on the ground from the creep’s Store.
Sourcefn notify_when_attacked(
&self,
enabled: bool,
) -> Result<(), NotifyWhenAttackedErrorCode>
fn notify_when_attacked( &self, enabled: bool, ) -> Result<(), NotifyWhenAttackedErrorCode>
Whether to send an email notification when this creep is attacked.
Sourcefn pickup(&self, target: &Resource) -> Result<(), PickupErrorCode>
fn pickup(&self, target: &Resource) -> Result<(), PickupErrorCode>
Pick up a Resource in melee range (or at the same position as the
creep).
Sourcefn say(&self, message: &str, public: bool) -> Result<(), SayErrorCode>
fn say(&self, message: &str, public: bool) -> Result<(), SayErrorCode>
Display a string in a bubble above the creep next tick. 10 character limit.
Sourcefn suicide(&self) -> Result<(), SuicideErrorCode>
fn suicide(&self) -> Result<(), SuicideErrorCode>
Immediately kill the creep.
Sourcefn transfer<T>(
&self,
target: &T,
ty: ResourceType,
amount: Option<u32>,
) -> Result<(), TransferErrorCode>where
T: Transferable + ?Sized,
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.
Sourcefn withdraw<T>(
&self,
target: &T,
ty: ResourceType,
amount: Option<u32>,
) -> Result<(), WithdrawErrorCode>where
T: Withdrawable + ?Sized,
fn withdraw<T>(
&self,
target: &T,
ty: ResourceType,
amount: Option<u32>,
) -> Result<(), WithdrawErrorCode>where
T: Withdrawable + ?Sized,
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.