2020-10-30 16:39:53 +00:00
|
|
|
use hashbrown::HashSet;
|
|
|
|
use serde::{Deserialize, Serialize};
|
2023-04-12 08:17:49 +00:00
|
|
|
use specs::{Component, VecStorage};
|
2020-10-30 16:39:53 +00:00
|
|
|
use vek::*;
|
|
|
|
|
|
|
|
// Distance from fuzzy_chunk before snapping to current chunk
|
|
|
|
pub const CHUNK_FUZZ: u32 = 2;
|
|
|
|
// Distance out of the range of a region before removing it from subscriptions
|
|
|
|
pub const REGION_FUZZ: u32 = 16;
|
|
|
|
|
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
pub struct RegionSubscription {
|
|
|
|
pub fuzzy_chunk: Vec2<i32>,
|
2022-08-22 03:21:39 +00:00
|
|
|
pub last_entity_view_distance: u32,
|
2020-10-30 16:39:53 +00:00
|
|
|
pub regions: HashSet<Vec2<i32>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Component for RegionSubscription {
|
2022-08-22 03:21:39 +00:00
|
|
|
type Storage = specs::DenseVecStorage<Self>;
|
2020-10-30 16:39:53 +00:00
|
|
|
}
|
2021-07-16 21:33:31 +00:00
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
|
2023-04-12 08:17:49 +00:00
|
|
|
pub struct RepositionOnChunkLoad {
|
|
|
|
pub needs_ground: bool,
|
|
|
|
}
|
2021-07-16 21:33:31 +00:00
|
|
|
|
|
|
|
impl Component for RepositionOnChunkLoad {
|
2023-04-12 08:17:49 +00:00
|
|
|
type Storage = VecStorage<Self>;
|
2021-07-16 21:33:31 +00:00
|
|
|
}
|