mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
34 lines
880 B
Rust
34 lines
880 B
Rust
use crate::{sync::Uid, Explosion};
|
|
use serde::{Deserialize, Serialize};
|
|
use specs::{Component, FlaggedStorage};
|
|
use specs_idvs::IdvStorage;
|
|
use std::time::Duration;
|
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub enum Effect {
|
|
Damage(i32),
|
|
Knockback(f32),
|
|
RewardEnergy(u32),
|
|
Explode(Explosion),
|
|
Vanish,
|
|
Stick,
|
|
Possess,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct Projectile {
|
|
// TODO: use SmallVec for these effects
|
|
pub hit_solid: Vec<Effect>,
|
|
pub hit_entity: Vec<Effect>,
|
|
/// Time left until the projectile will despawn
|
|
pub time_left: Duration,
|
|
pub owner: Option<Uid>,
|
|
/// Whether projectile collides with entities in the same group as its
|
|
/// owner
|
|
pub ignore_group: bool,
|
|
}
|
|
|
|
impl Component for Projectile {
|
|
type Storage = FlaggedStorage<Self, IdvStorage<Self>>;
|
|
}
|