veloren/common/src/comp/projectile.rs

28 lines
671 B
Rust
Raw Normal View History

2019-11-24 20:12:03 +00:00
use crate::{comp, sync::Uid};
2019-09-26 16:48:37 +00:00
use specs::{Component, FlaggedStorage};
2019-09-17 12:43:19 +00:00
use specs_idvs::IDVStorage;
use std::time::Duration;
2019-09-17 12:43:19 +00:00
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum Effect {
Damage(comp::HealthChange),
2019-09-17 12:43:19 +00:00
Vanish,
2019-09-28 19:35:28 +00:00
Stick,
Possess,
2019-09-17 12:43:19 +00:00
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Projectile {
pub owner: Uid,
2019-11-04 00:57:36 +00:00
// TODO: use SmallVec for these effects
2019-09-17 12:43:19 +00:00
pub hit_ground: Vec<Effect>,
2019-09-29 08:37:07 +00:00
pub hit_wall: Vec<Effect>,
2019-09-17 12:43:19 +00:00
pub hit_entity: Vec<Effect>,
/// Time left until the projectile will despawn
pub time_left: Duration,
2019-09-17 12:43:19 +00:00
}
impl Component for Projectile {
type Storage = FlaggedStorage<Self, IDVStorage<Self>>;
}