pub struct RegionCoordinate {
pub x: i64,
pub y: i64,
pub z: i64,
}Expand description
Server region coordinates (i64 for grid-based regions).
This type represents a region’s position in a discrete 3D grid, where each cell can contain one server instance.
Fields§
§x: i64§y: i64§z: i64Implementations§
Source§impl RegionCoordinate
impl RegionCoordinate
Sourcepub fn manhattan_distance(&self, other: &RegionCoordinate) -> i64
pub fn manhattan_distance(&self, other: &RegionCoordinate) -> i64
Calculate Manhattan distance to another region.
Sourcepub fn adjacent_regions(&self) -> Vec<RegionCoordinate>
pub fn adjacent_regions(&self) -> Vec<RegionCoordinate>
Get adjacent region coordinates (6 directions in 3D).
Sourcepub fn to_world_center(&self, region_size: f64) -> WorldCoordinate
pub fn to_world_center(&self, region_size: f64) -> WorldCoordinate
Convert region coordinate to world coordinate center.
Uses the region size to calculate the center point of this region.
Sourcepub fn from_world_coordinate(coord: &WorldCoordinate, region_size: f64) -> Self
pub fn from_world_coordinate(coord: &WorldCoordinate, region_size: f64) -> Self
Calculate which region a world coordinate belongs to.
Trait Implementations§
Source§impl Clone for RegionCoordinate
impl Clone for RegionCoordinate
Source§fn clone(&self) -> RegionCoordinate
fn clone(&self) -> RegionCoordinate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RegionCoordinate
impl Debug for RegionCoordinate
Source§impl Default for RegionCoordinate
impl Default for RegionCoordinate
Source§fn default() -> RegionCoordinate
fn default() -> RegionCoordinate
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RegionCoordinate
impl<'de> Deserialize<'de> for RegionCoordinate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for RegionCoordinate
impl Hash for RegionCoordinate
Source§impl PartialEq for RegionCoordinate
impl PartialEq for RegionCoordinate
Source§impl Serialize for RegionCoordinate
impl Serialize for RegionCoordinate
impl Copy for RegionCoordinate
impl Eq for RegionCoordinate
impl StructuralPartialEq for RegionCoordinate
Auto Trait Implementations§
impl Freeze for RegionCoordinate
impl RefUnwindSafe for RegionCoordinate
impl Send for RegionCoordinate
impl Sync for RegionCoordinate
impl Unpin for RegionCoordinate
impl UnwindSafe for RegionCoordinate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more