diff options
| author | troido <troido@protonmail.com> | 2020-04-15 12:23:06 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-04-15 12:23:06 +0200 |
| commit | 43bde225ebbadd0b917ca87f3164a50455a2b588 (patch) | |
| tree | c9c2bb0c6839af01a02acba1c338b2d8c59cfcb5 /src/components | |
| parent | 30a5688010bf07a9e0807ed0c2dc7c51f0e9dae4 (diff) | |
visit other players
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> +} + |
