veloren/common/src/comp/phys.rs

39 lines
748 B
Rust
Raw Normal View History

use specs::{Component, FlaggedStorage, NullStorage, VecStorage};
2019-01-02 19:22:01 +00:00
use vek::*;
// Position
2019-01-02 19:22:01 +00:00
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
2019-01-02 19:22:01 +00:00
pub struct Pos(pub Vec3<f32>);
impl Component for Pos {
type Storage = VecStorage<Self>;
2019-01-02 19:22:01 +00:00
}
// Velocity
2019-01-02 19:22:01 +00:00
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
2019-01-02 19:22:01 +00:00
pub struct Vel(pub Vec3<f32>);
impl Component for Vel {
type Storage = VecStorage<Self>;
2019-01-02 19:22:01 +00:00
}
// Direction
2019-01-02 19:22:01 +00:00
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
2019-01-02 19:22:01 +00:00
pub struct Dir(pub Vec3<f32>);
impl Component for Dir {
type Storage = VecStorage<Self>;
}
// ForceUpdate
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
pub struct ForceUpdate;
impl Component for ForceUpdate {
type Storage = NullStorage<Self>;
}