pub struct GameMap {
pub set_id: String,
pub step: f32,
pub grid: Vec<Vec<i32>>,
pub physics_static: Vec<i32>,
pub respawns: IndexMap<String, Vec<[f32; 3]>>,
/* private fields */
}Expand description
Карта в мире: порт физической части src/server/parts/Map.js + масштабирование из RoundManager.createMap (scaleMapData).
Fields§
§set_id: String§step: f32Размер тайла после масштабирования.
grid: Vec<Vec<i32>>Сетка тайлов (немасштабируемая) — источник нав-сетки ботов.
physics_static: Vec<i32>§respawns: IndexMap<String, Vec<[f32; 3]>>Респауны по командам (масштабированные) — [x, y, angle°].
Implementations§
Source§impl GameMap
impl GameMap
Sourcepub fn create(
world: &mut PhysicsWorld,
cfg: &MapConfig,
default_scale: f32,
default_set_id: &str,
) -> Self
pub fn create( world: &mut PhysicsWorld, cfg: &MapConfig, default_scale: f32, default_set_id: &str, ) -> Self
Создаёт тела карты в мире. default_scale/default_set_id —
значения конфига, перекрываемые полями самой карты.
pub fn static_body_count(&self) -> usize
pub fn dynamic_body_count(&self) -> usize
Sourcepub fn destroy(&mut self, world: &mut PhysicsWorld)
pub fn destroy(&mut self, world: &mut PhysicsWorld)
Удаляет все тела карты из мира (Map.destroyMap).
Sourcepub fn dynamic_map_data(
&self,
world: &PhysicsWorld,
with_velocities: bool,
) -> Vec<(u8, Vec<FieldValue>)>
pub fn dynamic_map_data( &self, world: &PhysicsWorld, with_velocities: bool, ) -> Vec<(u8, Vec<FieldValue>)>
Краткие данные динамических элементов (Map.getDynamicMapData): индекс → [x, y, angle] (как поля строки блока), значения скруглены до 2 знаков.
При with_velocities движущееся тело отдаёт ещё и хвост
[vx, vy, angvel] (кадр v4, optionalFrom в схеме блока): клиент
предсказывает динамику карты рядом со своим танком, а оценка скорости
конечной разностью между кадрами 30 Гц сильнее всего врёт именно в
момент удара. Покоящееся тело хвост не шлёт.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GameMap
impl<'de> Deserialize<'de> for GameMap
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>,
Auto Trait Implementations§
impl Freeze for GameMap
impl RefUnwindSafe for GameMap
impl Send for GameMap
impl Sync for GameMap
impl Unpin for GameMap
impl UnsafeUnpin for GameMap
impl UnwindSafe for GameMap
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.