veloren_voxygen/ecs/
comp.rs

1use common::{comp::Ori, outcome::HealthChangeInfo};
2use specs::{Component, VecStorage};
3use vek::*;
4
5// Floats over entity that has had a health change, rising up over time until it
6// vanishes
7#[derive(Copy, Clone, Debug)]
8pub struct HpFloater {
9    pub timer: f32,
10    // Used for the "jumping" animation of the HpFloater whenever it changes it's value
11    pub jump_timer: f32,
12    pub info: HealthChangeInfo,
13    // Used for randomly offsetting
14    pub rand: f32,
15}
16#[derive(Clone, Debug, Default)]
17pub struct HpFloaterList {
18    // Order oldest to newest
19    pub floaters: Vec<HpFloater>,
20
21    // The time since you last damaged this entity
22    // Used to display nametags outside normal range if this time is below a certain value
23    pub time_since_last_dmg_by_me: Option<f32>,
24}
25impl Component for HpFloaterList {
26    type Storage = VecStorage<Self>;
27}
28
29// Used for smooth interpolation of visual elements that are tied to entity
30// position
31#[derive(Copy, Clone, Debug)]
32pub struct Interpolated {
33    pub pos: Vec3<f32>,
34    pub ori: Ori,
35}
36impl Component for Interpolated {
37    type Storage = VecStorage<Self>;
38}