Struct screeps::objects::RoomPosition
source · pub struct RoomPosition(_);
Implementations
sourceimpl RoomPosition
impl RoomPosition
pub fn new(x: u32, y: u32, room_name: &str) -> Self
pub fn x(&self) -> u32
pub fn y(&self) -> u32
pub fn room_name(&self) -> String
pub fn local(&self) -> LocalRoomPosition
pub fn create_construction_site(&self, ty: StructureType) -> ReturnCode
pub fn create_named_construction_site(
&self,
ty: StructureType,
name: &str
) -> ReturnCode
pub fn create_flag(
&self,
name: &str,
main_color: Color,
secondary_color: Color
) -> ReturnCode
pub fn find_closest_by_range<T>(&self, ty: T) -> Option<T::Item>where
T: FindConstant,
pub fn find_in_range<T>(&self, ty: T, range: u32) -> Vec<T::Item>where
T: FindConstant,
pub fn find_path_to<'a, F, T>(&self, target: &T, opts: FindOptions<'a, F>) -> Pathwhere
F: Fn(String, CostMatrix<'_>) -> Option<CostMatrix<'a>> + 'a,
T: HasPosition,
pub fn find_path_to_xy<'a, F>(
&self,
x: u32,
y: u32,
opts: FindOptions<'a, F>
) -> Pathwhere
F: Fn(String, CostMatrix<'_>) -> Option<CostMatrix<'a>> + 'a,
pub fn get_direction_to<T>(&self, target: &T) -> Directionwhere
T: HasPosition,
pub fn get_range_to<T>(&self, target: &T) -> u32where
T: HasPosition,
pub fn in_range_to<T>(&self, target: &T, range: u32) -> boolwhere
T: HasPosition,
pub fn is_equal_to<T>(&self, target: &T) -> boolwhere
T: HasPosition,
pub fn is_equal_to_xy(&self, x: u32, y: u32) -> bool
pub fn is_near_to<T>(&self, target: &T) -> boolwhere
T: HasPosition,
pub fn look(&self) -> Vec<LookResult>
pub fn look_for<T>(&self, ty: T) -> Vec<T::Item>where
T: LookConstant,
Trait Implementations
sourceimpl AsRef<Reference> for RoomPosition
impl AsRef<Reference> for RoomPosition
sourceimpl Clone for RoomPosition
impl Clone for RoomPosition
sourcefn clone(&self) -> RoomPosition
fn clone(&self) -> RoomPosition
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl From<RoomPosition> for Reference
impl From<RoomPosition> for Reference
sourcefn from(value: RoomPosition) -> Self
fn from(value: RoomPosition) -> Self
Converts to this type from the input type.
sourceimpl FromExpectedType<Reference> for RoomPosition
impl FromExpectedType<Reference> for RoomPosition
fn from_expected_type(reference: Reference) -> Result<Self, ConversionError>
sourceimpl HasPosition for RoomPosition
impl HasPosition for RoomPosition
fn pos(&self) -> RoomPosition
sourceimpl InstanceOf for RoomPosition
impl InstanceOf for RoomPosition
sourcefn instance_of(reference: &Reference) -> bool
fn instance_of(reference: &Reference) -> bool
Checks whenever a given Reference if of type
Self
.sourceimpl<T: HasPosition> PartialEq<T> for RoomPosition
impl<T: HasPosition> PartialEq<T> for RoomPosition
sourceimpl ReferenceType for RoomPosition
impl ReferenceType for RoomPosition
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
sourceimpl<'_r> TryFrom<&'_r Reference> for RoomPosition
impl<'_r> TryFrom<&'_r Reference> for RoomPosition
sourceimpl<'_r> TryFrom<&'_r Value> for RoomPosition
impl<'_r> TryFrom<&'_r Value> for RoomPosition
sourceimpl TryFrom<Reference> for RoomPosition
impl TryFrom<Reference> for RoomPosition
sourceimpl TryFrom<RoomPosition> for Reference
impl TryFrom<RoomPosition> for Reference
sourceimpl TryFrom<Value> for RoomPosition
impl TryFrom<Value> for RoomPosition
impl Eq for RoomPosition
impl JsSerialize for RoomPosition
Auto Trait Implementations
impl RefUnwindSafe for RoomPosition
impl Send for RoomPosition
impl Sync for RoomPosition
impl Unpin for RoomPosition
impl UnwindSafe for RoomPosition
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