2020-10-17 22:42:43 +00:00
|
|
|
use crate::{sync::Uid, Damages};
|
2020-08-08 20:53:55 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use specs::{Component, FlaggedStorage};
|
|
|
|
use specs_idvs::IdvStorage;
|
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
2020-08-08 22:22:21 +00:00
|
|
|
pub struct Properties {
|
|
|
|
pub angle: f32,
|
2020-10-12 22:55:55 +00:00
|
|
|
pub vertical_angle: f32,
|
2020-08-08 22:22:21 +00:00
|
|
|
pub speed: f32,
|
2020-10-17 22:42:43 +00:00
|
|
|
pub damages: Damages,
|
2020-08-08 20:53:55 +00:00
|
|
|
pub knockback: f32,
|
|
|
|
pub requires_ground: bool,
|
2020-08-08 22:22:21 +00:00
|
|
|
pub duration: Duration,
|
2020-08-08 20:53:55 +00:00
|
|
|
pub owner: Option<Uid>,
|
|
|
|
}
|
|
|
|
|
2020-08-08 22:22:21 +00:00
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct Shockwave {
|
|
|
|
pub properties: Properties,
|
|
|
|
#[serde(skip)]
|
|
|
|
/// Time that the shockwave was created at
|
|
|
|
/// Used to calculate shockwave propagation
|
|
|
|
/// Deserialized from the network as `None`
|
|
|
|
pub creation: Option<f64>,
|
|
|
|
}
|
|
|
|
|
2020-08-08 20:53:55 +00:00
|
|
|
impl Component for Shockwave {
|
|
|
|
type Storage = FlaggedStorage<Self, IdvStorage<Self>>;
|
|
|
|
}
|
2020-08-08 22:22:21 +00:00
|
|
|
|
|
|
|
impl std::ops::Deref for Shockwave {
|
|
|
|
type Target = Properties;
|
|
|
|
|
|
|
|
fn deref(&self) -> &Properties { &self.properties }
|
|
|
|
}
|
2020-10-08 00:32:30 +00:00
|
|
|
|
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct ShockwaveHitEntities {
|
|
|
|
pub hit_entities: Vec<Uid>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Component for ShockwaveHitEntities {
|
|
|
|
type Storage = IdvStorage<Self>;
|
|
|
|
}
|