veloren/common/src/comp/inputs.rs

95 lines
1.9 KiB
Rust
Raw Normal View History

use specs::{Component, FlaggedStorage, NullStorage, VecStorage};
use vek::*;
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub struct Respawning;
2019-06-09 19:33:20 +00:00
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct MoveDir(pub Vec2<f32>);
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct Attacking {
pub time: f32,
pub applied: bool,
}
2019-06-09 14:20:20 +00:00
2019-06-30 02:13:34 +00:00
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct Wielding {
pub time: f32,
pub applied: bool,
}
2019-06-11 04:08:55 +00:00
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct Rolling {
pub time: f32,
pub applied: bool,
}
2019-06-09 19:33:20 +00:00
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct OnGround;
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct Jumping;
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct Gliding;
impl Component for Respawning {
type Storage = NullStorage<Self>;
}
impl Attacking {
pub fn start() -> Self {
Self {
time: 0.0,
applied: false,
}
}
}
2019-06-09 14:20:20 +00:00
2019-06-30 02:13:34 +00:00
impl Wielding {
pub fn start() -> Self {
Self {
time: 0.0,
applied: false,
}
}
}
2019-06-11 04:08:55 +00:00
impl Rolling {
pub fn start() -> Self {
Self {
time: 0.0,
applied: false,
}
}
}
2019-06-09 19:33:20 +00:00
impl Component for MoveDir {
type Storage = VecStorage<Self>;
}
impl Component for Attacking {
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
}
2019-06-30 02:13:34 +00:00
impl Component for Wielding {
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
}
2019-06-11 04:08:55 +00:00
impl Component for Rolling {
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
}
2019-06-09 19:33:20 +00:00
impl Component for OnGround {
type Storage = NullStorage<Self>;
}
impl Component for Jumping {
type Storage = NullStorage<Self>;
}
impl Component for Gliding {
type Storage = FlaggedStorage<Self, NullStorage<Self>>;
}