diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/interactable.rs | 14 | ||||
| -rw-r--r-- | src/components/mod.rs | 7 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/components/interactable.rs b/src/components/interactable.rs index 1787a33..3432f33 100644 --- a/src/components/interactable.rs +++ b/src/components/interactable.rs @@ -8,7 +8,8 @@ use specs::{ use crate::{ exchange::Exchange, ItemId, - components::Trigger + components::Trigger, + RoomId }; #[derive(Component, Debug, Clone, PartialEq)] @@ -17,7 +18,8 @@ pub enum Interactable { Trigger(Trigger), Say(String), Reply(String), - Exchange(String, HashMap<String, Exchange>) + Exchange(String, HashMap<String, Exchange>), + Visit(RoomId) } use Interactable::*; @@ -44,6 +46,7 @@ impl Interactable { }) .collect::<Option<HashMap<String, Exchange>>>()? ), + "visit" => Visit(RoomId::from_str(arg.as_str()?)), _ => None? }) } @@ -60,6 +63,13 @@ impl Interactable { true } } + Visit(_) => { + if let Some(txt) = arg { + txt.starts_with("visit") + } else { + false + } + } } } } diff --git a/src/components/mod.rs b/src/components/mod.rs index 6692445..ae50edc 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -29,6 +29,8 @@ pub use ear::{ Ear }; +use std::collections::HashMap; + use specs::{ DenseVecStorage, VecStorage, @@ -225,6 +227,11 @@ pub struct Build { pub obj: Template } +#[derive(Component, Debug, Clone)] +pub struct Whitelist{ + pub allowed: HashMap<String, PlayerId> +} + |
