mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
21 lines
708 B
Rust
21 lines
708 B
Rust
|
use specs::{Component, Entity};
|
||
|
use specs_idvs::IdvStorage;
|
||
|
use vek::Vec2;
|
||
|
|
||
|
/// This component exists in order to fix a bug that caused entities
|
||
|
/// such as campfires to duplicate because the chunk was double-loaded.
|
||
|
/// See https://gitlab.com/veloren/veloren/-/merge_requests/1543
|
||
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||
|
pub enum Anchor {
|
||
|
/// An entity with an Entity Anchor will be destroyed when its anchor Entity
|
||
|
/// no longer exists
|
||
|
Entity(Entity),
|
||
|
/// An entity with Chunk Anchor will be destroyed when both the chunk it's
|
||
|
/// currently positioned within and its anchor chunk are unloaded
|
||
|
Chunk(Vec2<i32>),
|
||
|
}
|
||
|
|
||
|
impl Component for Anchor {
|
||
|
type Storage = IdvStorage<Self>;
|
||
|
}
|