pub struct Room(_);
Implementations
sourceimpl Room
impl Room
pub fn controller(&self) -> Option<StructureController>
pub fn energy_available(&self) -> u32
pub fn energy_capacity_available(&self) -> u32
pub fn name(&self) -> String
pub fn storage(&self) -> Option<StructureStorage>
pub fn terminal(&self) -> Option<StructureTerminal>
sourceimpl Room
impl Room
pub fn serialize_path(&self, path: &[Step]) -> String
pub fn deserialize_path(&self, path: &str) -> Vec<Step>
pub fn create_construction_site<T>(&self, at: T, ty: StructureType) -> ReturnCodewhere
T: HasPosition,
pub fn create_named_construction_site<T>(
&self,
at: T,
ty: StructureType,
name: &str
) -> ReturnCodewhere
T: HasPosition,
pub fn create_flag<T>(
&self,
at: T,
name: &str,
main_color: Color,
secondary_color: Color
) -> ReturnCodewhere
T: HasPosition,
pub fn find<T>(&self, ty: T) -> Vec<T::Item>where
T: FindConstant,
pub fn find_exit_to(&self, room: &Room) -> Result<Exit, ReturnCode>
pub fn get_event_log(&self) -> Vec<Event>
pub fn get_event_log_raw(&self) -> String
pub fn get_position_at(&self, x: u32, y: u32) -> Option<RoomPosition>
pub fn get_terrain(&self) -> RoomTerrain
pub fn look_at<T: HasPosition>(&self, target: &T) -> Vec<LookResult>
pub fn look_at_xy(&self, x: u32, y: u32) -> Vec<LookResult>
pub fn look_at_area(
&self,
top: u32,
left: u32,
bottom: u32,
right: u32
) -> Vec<PositionedLookResult>
pub fn find_path<'a, O, T, F>(
&self,
from_pos: &O,
to_pos: &T,
opts: FindOptions<'a, F>
) -> Pathwhere
O: HasPosition,
T: HasPosition,
F: Fn(String, CostMatrix<'_>) -> Option<CostMatrix<'a>> + 'a,
pub fn look_for_at<T, U>(&self, ty: T, target: U) -> Vec<T::Item>where
T: LookConstant,
U: HasPosition,
sourcepub fn look_for_at_area<T>(
&self,
ty: T,
horiz: Range<u8>,
vert: Range<u8>
) -> Vec<T::Item>where
T: LookConstant,
pub fn look_for_at_area<T>(
&self,
ty: T,
horiz: Range<u8>,
vert: Range<u8>
) -> Vec<T::Item>where
T: LookConstant,
Looks for a given thing over a given area of bounds.
To keep with Range
convention, the start is inclusive, and the end
is exclusive.
Note: to ease the implementation and efficiency of the rust interface, this is limited to returning an array of values without their positions. If position data is needed, all room objects should contain positions alongside them. (for terrain data, I would recommend using a different method?)
If you really do need more information here, I would recommend making a PR to add it!
Panics
Panics if start>end for either range, or if end>50 for either range.
Examples
use screeps::constants::look;
room.look_for_at_area(look::ENERGY, 20..26, 20..26);
pub fn memory(&self) -> MemoryReference
pub fn name_local(&self) -> LocalRoomName
Trait Implementations
sourceimpl FromExpectedType<Reference> for Room
impl FromExpectedType<Reference> for Room
fn from_expected_type(reference: Reference) -> Result<Self, ConversionError>
sourceimpl InstanceOf for Room
impl InstanceOf for Room
sourcefn instance_of(reference: &Reference) -> bool
fn instance_of(reference: &Reference) -> bool
Checks whenever a given Reference if of type
Self
.sourceimpl ReferenceType for Room
impl ReferenceType for Room
sourceunsafe fn from_reference_unchecked(reference: Reference) -> Self
unsafe fn from_reference_unchecked(reference: Reference) -> Self
Converts a given reference into a concrete reference-like wrapper.
Doesn’t do any type checking; highly unsafe to use! Read more
impl Eq for Room
impl JsSerialize for Room
Auto Trait Implementations
impl RefUnwindSafe for Room
impl Send for Room
impl Sync for Room
impl Unpin for Room
impl UnwindSafe for Room
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromExpectedType<Value> for Twhere
T: FromExpectedType<Reference>,
impl<T> FromExpectedType<Value> for Twhere
T: FromExpectedType<Reference>,
fn from_expected_type(v: Value) -> Result<T, ConversionError>
sourceimpl<T, U> IntoExpectedType<U> for Twhere
U: FromExpectedType<T>,
impl<T, U> IntoExpectedType<U> for Twhere
U: FromExpectedType<T>,
sourcefn into_expected_type(self) -> Result<U, ConversionError>
fn into_expected_type(self) -> Result<U, ConversionError>
Casts this value as the target type, making the assumption that the types are correct. Read more