use std::cell::Cell;
use std::fmt;
use std::hash::{Hash, Hasher};
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Default)]
pub struct PlayerStatus {
pub is_walking: Cell<bool>,
pub is_running: Cell<bool>,
pub is_swimming: Cell<bool>,
pub is_underwater: Cell<bool>
}
impl fmt::Display for PlayerStatus {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Player status")
}
}
impl Hash for PlayerStatus {
fn hash<H: Hasher>(&self, state: &mut H) {
self.is_walking.get().hash(state);
self.is_running.get().hash(state);
self.is_swimming.get().hash(state);
self.is_underwater.get().hash(state);
}
}
impl PlayerStatus {
pub fn empty() -> Self {
PlayerStatus {
is_walking: Cell::new(false),
is_running: Cell::new(false),
is_swimming: Cell::new(false),
is_underwater: Cell::new(false)
}
}
}