veloren/common/src/comp/anchor.rs
Ben Wallis 01ca6911a9 * Pets are now saved on logout and spawned with the player on login
* Pets now teleport to their owner when they are too far away from them
* Limited the animals that can be tamed to `QuadrupedLow` and `QuadrupedSmall` to prevent players taming overly powerful creatures before the pet feature is further developed
* Added `Pet` component used to store pet information about an entity - currently only used to store the pet's database ID
* Added `pet` database table which stores a pet's `body_id` and `name`, alongside the `character_id` that it belongs to
* Replaced `HomeChunk` component with more flexible `Anchor` component which supports anchoring entities to other entities as well as chunks.
2021-07-28 22:36:41 +00:00

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>;
}