From 4f9932074a8f0390d5cb6072b4e419c7ab08ffed Mon Sep 17 00:00:00 2001 From: troido Date: Thu, 2 Apr 2020 14:13:18 +0200 Subject: added flags component, and conditions for building --- src/components/flags.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/components/flags.rs (limited to 'src/components/flags.rs') diff --git a/src/components/flags.rs b/src/components/flags.rs new file mode 100644 index 0000000..d985bf2 --- /dev/null +++ b/src/components/flags.rs @@ -0,0 +1,32 @@ + +use std::collections::HashSet; +use specs::{ + Component, + VecStorage, +}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum Flag { + Blocking, + Floor, + Occupied, + Soil +} + +use Flag::*; +impl Flag { + pub fn from_str(s: &str) -> Option { + Some(match s { + "Blocking" => Blocking, + "Floor" => Floor, + "Occupied" => Occupied, + "Soil" => Soil, + _ => None? + }) + } +} + + +#[derive(Component, Debug, Clone, PartialEq, Eq)] +#[storage(VecStorage)] +pub struct Flags(pub HashSet); -- cgit