summaryrefslogtreecommitdiff
path: root/src/components/interactable.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-04-17 11:15:02 +0200
committertroido <troido@protonmail.com>2020-04-17 11:15:02 +0200
commit13e9ab2c859b9a6a1935acbb93d34a7f10b7e122 (patch)
treee28b2e0d944dc6fad62d6407a411598cedc935cf /src/components/interactable.rs
parent608918af8174e9afb761cdd2ad46e489b21c5f4e (diff)
added Mine interaction
Diffstat (limited to 'src/components/interactable.rs')
-rw-r--r--src/components/interactable.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/components/interactable.rs b/src/components/interactable.rs
index f1f0508..f48fb9d 100644
--- a/src/components/interactable.rs
+++ b/src/components/interactable.rs
@@ -8,7 +8,7 @@ use specs::{
use crate::{
exchange::Exchange,
ItemId,
- components::Trigger,
+ components::{Trigger, equipment::Stat},
RoomId
};
@@ -19,7 +19,8 @@ pub enum Interactable {
Say(String),
Reply(String),
Exchange(String, HashMap<String, Exchange>),
- Visit(RoomId)
+ Visit(RoomId),
+ Mine(Stat)
}
use Interactable::*;
@@ -47,6 +48,7 @@ impl Interactable {
.collect::<Option<HashMap<String, Exchange>>>()?
),
"visit" => Visit(RoomId::from_str(arg.as_str()?)),
+ "mine" => Mine(Stat::from_str(arg.as_str()?)?),
_ => None?
})
}
@@ -62,7 +64,7 @@ impl Interactable {
} else {
true
}
- }
+ },
Visit(_) => {
if let Some(txt) = arg {
txt.starts_with("visit ") || txt.starts_with("disallow ") || txt.starts_with("allow ") || txt.starts_with("whitelist")
@@ -70,6 +72,7 @@ impl Interactable {
false
}
}
+ Mine(_) => arg.is_none()
}
}
}